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 / rake.sh
Created March 29, 2011 12:08 — forked from turadg/rake.sh
# bash completion for rake
#
# some code from on Jonathan Palardy's http://technotales.wordpress.com/2009/09/18/rake-completion-cache/
# and http://pastie.org/217324 found http://ragonrails.com/post/38905212/rake-bash-completion-ftw
#
# For details and discussion
# http://turadg.aleahmad.net/2011/02/bash-completion-for-rake-tasks/
#
# INSTALL
#
@felixhummel
felixhummel / getcert
Created April 11, 2011 22:49
Get a (self-signed) SSL certificate for Ubuntu 10.10
#!/bin/bash
HOSTNAME=$1
TMPFILE=`mktemp`
FNAME=$HOSTNAME.crt
expect_cmd() {
cmd=$1
package=$2
which $cmd &> /dev/null
# load global bash completion
if [[ -f /etc/bash_completion ]]; then
. /etc/bash_completion
fi
# load everything under ~/.bash/
if [[ -d $HOME/.bash/ ]]; then
for f in $HOME/.bash/*; do
source $f
done
@felixhummel
felixhummel / bindings.sh
Created October 16, 2011 08:53
$HOME/.bash/bindings.sh
# how to create new shortcuts:
# run ``cat > /tmp/x``
# type your shortcut
# press enter (creates new line still in cat)
# press C-d to send EOF to cat
# run ``cat -v /tmp/x | sed 's;\^\[;\\e;'``
# paste output here
# ipython style history
bind '"\e[A":history-search-backward'
@felixhummel
felixhummel / build-nginx.sh
Created October 31, 2011 19:41
Build Nginx 1.0.8 on Ubuntu 10.10 with reverse web socket capabilities
# http://www.letseehere.com/reverse-proxy-web-sockets
export VERSION=1.0.8
export PREFIX=/usr/local
export USERNAME=nginx
export GECOS='nginx web server'
filename=nginx-$VERSION.tar.gz
set -x # print commands