Integral representation of the Euler-Mascheroni constant involving $\pi$

So here is my proof:

Two important things that i wont proof here are

$\lfloor x\rfloor = \frac {\arctan(\cot(x\pi))}\pi - \frac 12 + x$ and

$\sum_{n=1}^x \frac 1n = \frac {\lfloor x\rfloor}x + \int_1^x \frac {\lfloor t\rfloor}{t^2} \,dt$

But those are well known facts.

From this it follows that

$\sum_{n=1}^x \frac 1n = \frac {\arctan(\cot(x\pi))}{\pi x} - \frac 1{2x} + 1 + \int_1^x \frac {\arctan(\cot(t\pi))}{\pi t^2} - \frac 1{2t^2} + \frac 1t\,dt$

(simply substitute the first into the second)

$\sum_{n=1}^x \frac 1n = \frac {\arctan(\cot(x\pi))}{\pi x} - \frac 1{2x} + 1 + \frac 1{2x} - \frac 12 + \ln(x) + \int_1^x \frac {\arctan(\cot(t\pi))}{\pi t^2} \,dt$

$\sum_{n=1}^x \frac 1n - \ln(x) = \frac 12 + \int_1^x \frac {\arctan(\cot(t\pi))}{\pi t^2} \,dt + \frac {\arctan(cot(x\pi))}{\pi x}$

Now take the limit as x goes to $\infty$

$\gamma = \frac 12 + \int_1^\infty \frac {\arctan(\cot(t\pi))}{\pi t^2} \,dt$

substituting in $u = \frac 1{\pi t}$ gives

$\gamma = \frac 12 + \int_0^{\frac 1{\pi}} \arctan(\cot(\frac 1u)) \,du$