Skip to content

Instantly share code, notes, and snippets.

View vosst's full-sized avatar
🏠
Working from home

Thomas Voß vosst

🏠
Working from home
  • Bochum, NRW, Germany
View GitHub Profile
@vosst
vosst / login.go
Last active September 11, 2019 09:58
Programmatic login procedure for AirMap's IAM
package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"os"
oidc "github.com/coreos/go-oidc"
@vosst
vosst / gist:ccf06ab922f316a6f7018206c179f0f7
Created September 27, 2017 07:55
`valgrind` output with fix
==99== HEAP SUMMARY:
==99== in use at exit: 1,496,487 bytes in 2,534 blocks
==99== total heap usage: 46,029 allocs, 43,495 frees, 100,254,527 bytes allocated
==99==
==99== LEAK SUMMARY:
==99== definitely lost: 0 bytes in 0 blocks
==99== indirectly lost: 0 bytes in 0 blocks
==99== possibly lost: 114,199 bytes in 611 blocks
==99== still reachable: 1,382,288 bytes in 1,923 blocks
==99== suppressed: 0 bytes in 0 blocks
@vosst
vosst / gist:f3de3db8c275f71991f5ba4434864928
Created September 27, 2017 07:51
`valgrind` output without fix
==91== Invalid read of size 8
==91== at 0x159D3AA: uv__stream_destroy (stream.c:447)
==91== by 0x1591C1F: uv__finish_close (core.c:264)
==91== by 0x1591C1F: uv__run_closing_handles (core.c:294)
==91== by 0x1591C1F: uv_run (core.c:364)
==91== by 0x1367A74: node::Start(uv_loop_s*, int, char const* const*, int, char const* const*) (in /usr/local/bin/node)
==91== by 0x1361752: node::Start(int, char**) (in /usr/local/bin/node)
==91== by 0x5CA1B44: (below main) (libc-start.c:287)
==91== Address 0x8f01478 is 24 bytes inside a block of size 208 free'd
==91== at 0x4C29E90: free (vg_replace_malloc.c:473)
With `frun -k -s 2 -N -m 4096`:
w/o buffering, process record: min: 0 us, mean: 0.40476 us, std.dev.: 6.96485 us, max: 1690 us
w/o buffering, read + process record: min: 13 us, mean: 24.3517 us, std.dev.: 292.387 us, max: 51807 us
With `frun -k -N -m 4096`:
w/o buffering, read + process record: min: 14 us, mean: 44.8505 us, std.dev.: 175.698 us, max: 27415 us
ERROR(
"You're not running the container-manager as root. Generally you don't"
"want to run the container-manager manually unless you're a developer"
"as it is started by the init system of your operating system.");
@vosst
vosst / rsa.go
Created April 4, 2017 06:54
Profiling Go's RSA key generation
package main
import (
"crypto/rand"
"crypto/rsa"
"os"
"runtime/pprof"
)
func main() {
package main
import (
"fmt"
"github.com/mitch000001/go-hbci/client"
)
func main() {
config := client.Config{
@vosst
vosst / CMakeLists.txt
Created November 21, 2015 20:30
Snippet to set a sensible fallback value for major.minor.patch
# We haven't received version information via the packaging setup.
# For that, we try to determine sensible values on our own, ensuring
# plain old invocations to cmake still work as expected.
if (NOT DEFINED TRUST_STORE_VERSION_MAJOR)
find_program(LSB_RELEASE lsb_release)
execute_process(
COMMAND ${LSB_RELEASE} -c -s
OUTPUT_VARIABLE DISTRO_CODENAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
@vosst
vosst / xdg.cpp
Last active November 12, 2015 11:31
#include "xdg.h"
#include <cstdlib>
#include <stdexcept>
namespace
{
std::string home_dir_or_throw()
{