Skip to content

Instantly share code, notes, and snippets.

View bebehei's full-sized avatar

Benedikt Heine bebehei

View GitHub Profile
@bebehei
bebehei / logfile
Created November 13, 2018 15:14
stringtest to check the optimisation of constant substrings
[bebe:~/stringtest] % gcc --version
gcc (GCC) 8.2.1 20180831
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[bebe:~/stringtest] % gcc -o stringtest stringtest.c -O0
[bebe:~/stringtest] % ./stringtest
sameptr: (diff: 0)
same1: 0x563efba8d004
same2: 0x563efba8d004
@bebehei
bebehei / .gitignore
Last active September 5, 2018 13:57
gdk pixbuf fileinfo tester
/gdkpb
@bebehei
bebehei / .gitignore
Last active April 25, 2018 13:20
simple cairo example taken with an additional net_wm_state_above atom to show if workspace manager works correct or not
/x
@bebehei
bebehei / gist:644282d5bd6bab89e753bca11eba7777
Created April 23, 2018 13:14
Temporary PKGBUILD to build coccinelle-git
# PKGBUILD builds current coccinelle master, as the current coccinelle stable release is not buildable on ArchLinux anymore.
# Diff it against https://aur.archlinux.org/cgit/aur.git/commit/?h=coccinelle&id=540550d09c602fac376a87544833eda2a77e9647
# Maintainer: Omar Sandoval <osandov at osandov dot com>
# Contributor: Roger Zanoni <rogerzanoni@gmail.com>
# Contributor: Sylvain Henry <hsyl20@gmail.com>
# Contributor: Marti Raudsepp <marti@juffo.org>
# Contributor: Dan McGee <dpmcgee@gmail.com>
# Contributor: LeCrayonVert <sunrider@laposte.net>
# Contributor: Lukas Fleischer <archlinux@cryptocrack.de>
@bebehei
bebehei / wsse.py
Created February 8, 2018 11:53
Python function to generate wsse headers
# See for WSSE key generation this link:
# https://oroinc.com/orocrm/doc/2.0/cookbook/how-to-use-wsse-authentication
# Returns a dictionary of headers
def genheaders(user_name, user_key):
random = str(uuid.uuid4()).encode('ascii')
nonce = hashlib.md5(random).digest()[0:16]
curdate = datetime.datetime.now().replace(microsecond=0)
hash_digest = hashlib.sha1()
hash_digest.update(nonce)
@bebehei
bebehei / .dockerignore
Last active January 7, 2018 15:23
seafile container
root/boot/
root/lib/modules
root/usr/include/
root/usr/src/
root/usr/src/
root/var/log/
!root/var/log/nginx
!root/var/log/seafile
root/var/lib/apt
root/tmp/*
@bebehei
bebehei / Dockerfile
Last active March 3, 2018 13:28
dunst-docker
FROM alpine
RUN apk add --no-cache \
cairo \
dbus \
glib \
gtk+3.0 \
libxdg-basedir \
libxft \
libxinerama \
@bebehei
bebehei / average.sh
Created May 1, 2017 10:11
Get average of linked libraries in your $PATH.
#!/bin/bash
# 'ldd % | wc -l | grep -v ^1$'
# ^ if file is not a dynamic linked executable, ldd will print one line on STDOUT, but we have to ignore this
find $(echo $PATH | tr : ' ') -mindepth 1 -maxdepth 1 \
| xargs -I% bash -c 'ldd % | wc -l | grep -v ^1$' \
while read line;\
do l=$((l + line));\
done \
&& echo $l
@bebehei
bebehei / update.sh
Last active June 2, 2018 20:01
nsupdate.info DDNS client
#!/bin/bash
set -euo pipefail
DNS_REC=<your record>
SEC=<secret>
INTERVAL=1200 # in seconds
DNS_MASTER="$(dig SOA +short "${DNS_REC}")"
unchanged4() {
@bebehei
bebehei / part.sh
Last active January 24, 2017 11:49
LVM/LUKS partition creation
#!/bin/bash
# stop on first error
set -e
DEVICE=/dev/sdb
LUKS_DEVNAME=CRYPTsys-$(hostname)
VGROUP=VGsys-$(hostname)
LV_VOLUME_PREFIX=LV-$(hostname)-
PART_PREFIX=$(hostname)-