Skip to content

Instantly share code, notes, and snippets.

View felixhummel's full-sized avatar

Felix Hummel felixhummel

View GitHub Profile
@felixhummel
felixhummel / insert_statement_to_alchemy_model.py
Created July 3, 2014 14:18
using sqlparse to convert sql insert statements to sqlalchemy model calls
import sqlparse
from sqlparse.sql import * # noqa
stmts = sqlparse.parse(open('data.sql').read())
TABLE_MODEL_MAP = dict(
sec_rolegroup='models.RoleGroup',
sec_role='models.Role',
sec_permissiongroup='models.PermissionGroup',
diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
index a65815f..6a772ed 100644
--- a/auto/lib/openssl/conf
+++ b/auto/lib/openssl/conf
@@ -28,10 +28,10 @@ if [ $OPENSSL != NONE ]; then
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
- CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
- CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
@felixhummel
felixhummel / .bashrc
Last active August 29, 2015 14:06
~/.pythonrc
export PYTHONSTARTUP=~/.pythonrc
@felixhummel
felixhummel / gist:589dc3ebdac5e4efb160
Created November 6, 2014 23:18
ipython[notebook] via pip on ubuntu 12.04
# probably missing some headers here ;)
sudo apt-get install build-essential python-dev libpng12-dev
# update pip (matplotlib wants latest)
sudo easy_install -U distribute
sudo pip install -U pyzmq "ipython[notebook]" matplotlib
# make stuff readable by all (got errors otherwise)
sudo chmod -R a+r /usr/local/lib/python2.7/dist-packages/{IPython,ipython-*,pyzmq-*,zmq*}
Host foo
User felix
HostName foo.example.org
ProxyCommand /usr/sbin/proxytunnel --proxy=ssh-proxy.example.org:2222 --proxyauth=username:password --dest=%h:%p
@felixhummel
felixhummel / ssh_config
Last active November 2, 2017 11:37
Useful defaults and example for ~/.ssh/config
# keep connections alive
ServerAliveInterval 60
# re-use connections to the same host
ControlMaster auto
# leave connection open in background
ControlPersist 4h
ControlPath /tmp/%r@%h:%p
# use `ssh -o ControlPath=none` to disable this temporarily
# and to close this: `ssh -O exit`
#!/bin/bash
vmname=$1
vboxmanage controlvm $vmname poweroff
vboxmanage unregistervm $vmname --delete
@felixhummel
felixhummel / vboxhostname
Created October 29, 2015 12:46
/usr/local/bin/vboxhostname
#!/bin/bash
# If you set the something stupid that's not a valid hostname, then it's your
# own fault. :P
set -euo pipefail
echo 'Ran vboxhostname' > /tmp/x
echo '----------------' >> /tmp/x
VBoxControl guestproperty get hostname 2>&1 >> /tmp/x
vboxhostname=$(VBoxControl guestproperty get hostname | grep Value | awk '{ print $2 }')
echo "Got $vboxhostname" >> /tmp/x
@felixhummel
felixhummel / vboxhostname.conf
Created October 29, 2015 12:47
/etc/init/vboxhostname.conf
description "Set Hostname from virtualbox 'hostname' property"
start on (starting network-interface
or starting network-manager
or starting networking)
task
exec /usr/local/bin/vboxhostname
@felixhummel
felixhummel / labbox
Last active October 29, 2015 13:07
~/bin/labbox
#!/bin/bash
set -euo pipefail
vmname=$1
PROXY=dns
DOMAIN=lab
vboxmanage clonevm node --snapshot cleanup --options link --name $vmname --register
vboxmanage guestproperty set $vmname hostname $vmname