Skip to content

Instantly share code, notes, and snippets.

View bjoern-r's full-sized avatar

Björn bjoern-r

  • Berlin; Germany
View GitHub Profile
@bjoern-r
bjoern-r / remote.xml
Created May 13, 2014 21:03
XBMC CEC Remote mappings for LG DTV LE2600
<!-- xbmc Remote -->
<keymap>
<global>
<remote>
<skipminus>back</skipminus>
<skipplus>ContextMenu</skipplus>
<!--stop>XBMC.ActivateWindow(Home)</stop-->
<pause>FullScreen</pause>
</remote>
</global>
@bjoern-r
bjoern-r / netatalk.conf
Created June 22, 2014 19:26
netatalk 3.x upstart script (/etc/init/netatalk.conf)
description "netatalk afp Server"
author "Bjoern Riemer <bjoern.riemer-ät-web.de>"
start on (local-filesystems and net-device-up and started avahi-daemon)
#start on runlevel [2345]
stop on runlevel [!2345]
respawn
expect daemon
@bjoern-r
bjoern-r / hexdump_bytes.c
Created October 13, 2014 10:28
simple hexdump function borrowed from (boundarydevices/imx_usb_loader)
#include <stdio.h>
void hexdump_bytes(unsigned char *src, unsigned cnt, unsigned addr)
{
unsigned char *p = src;
int i;
while (cnt >= 16) {
printf("%08x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", addr,
p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
p += 16;
@bjoern-r
bjoern-r / hex2bin.py
Created November 2, 2014 11:45
convert hex to binary in python.
#copied from http://ctfcrew.org/writeup/90
f = open('openwrt-wrtsl54gs-squashfs.hex', 'r')
w = open('openwrt-wrtsl54gs-squashfs.bin', 'wb')
lines = f.readlines()
for l in lines:
w.write(l.strip('\n').decode('hex'))
w.close()
@bjoern-r
bjoern-r / gist:4cabe21a4610f9e01073
Created July 28, 2015 14:19
docker visualstudio
sudo docker run --rm -it --env=XAUTHORITY=/tmp/.docker.xauth -v /tmp/.docker.xauth:/tmp/.docker.xauth -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --device /dev/dri --name visualstudio jess/visualstudio
@bjoern-r
bjoern-r / pastebinit-startup.sh
Created November 30, 2015 08:06
Start pastebin server
docker run -d --name=pastebinit -e PASTEBINIT_USERNAME=foo -e PASTEBINIT_PASS=aceme -p 8081:8081 bjoern/pastebinit -b http://demo.fiteagle.org:8081/ -p 8081
echo 'for cleanup run: docker exec -it pastebinit sh -c "find /files/ -mtime +10 | xargs echo rm"'
@bjoern-r
bjoern-r / rename_pictures.sh
Last active January 1, 2016 04:49
rename pictures and movies according the exif or file timestamp
## resulting filename 20121018-102347-IMG_4743.jpg
## rename pictures
jhead -n%Y%m%d-%H%M%S-%f *.JPG | tee rename.log
## create restore script
awk '{ print "mv " $3 " " $1 }' rename.log >rename_undo.sh
## rename movies
stat -t"%Y%m%d-%H%M%S" *.MOV | awk '{ print "echo mv " $16 " " $10"-"$16 }' | sh | tee rename-mov.log | sh -x
@bjoern-r
bjoern-r / refresh-ssl-certificates.sh
Created January 8, 2016 09:54
refresh letsencrypt ssl certificates for nginx using docker
#!/bin/sh
set -e
docker pull quay.io/letsencrypt/letsencrypt:latest
docker rm -f letsencrypt || true
for DOMAIN in foobar.de aceme.com ; do
docker run --rm --name letsencrypt \
-v "/data/nginx/static:/webroot" \
-v "/etc/letsencrypt:/etc/letsencrypt" \
git clone qt
git checkout stable
perl init-repository -no-webkit
./configure -opensource -confirm-license -no-accessibility -qt-sql-sqlite -qt-zlib -no-gif -no-libpng -no-libjpeg -nomake examples -no-gui -nomake tools -no-opengl -no-sm -no-xshape -no-xinerama -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-fontconfig -no-xkb -no-glib -openssl-linked -no-dbus -static -prefix /opt/Qt-5.3.1-static -no-xcb -no-eglfs -no-kms -no-directfb -no-linuxfb -no-cups -no-iconv -no-alsa
make -j 4
cd qtbase
make install
cd ../qtscript
make -j 4
@bjoern-r
bjoern-r / docker-cleanup.sh
Created June 8, 2016 08:34
cleanup local docker images
#!/bin/bash
echo "About to remove the following images:"
docker images | awk '/^<none>/ {print}'
echo "press <ctrl+c> to abort! <enter> to continue"
read foo
docker images | awk '/^<none>/ {print $3}' | xargs --no-run-if-empty docker rmi