Skip to content

Instantly share code, notes, and snippets.

View iheitlager's full-sized avatar

Ilja Heitlager iheitlager

View GitHub Profile
@iheitlager
iheitlager / git-extract-committers.sh
Last active December 10, 2015 02:48
extract all committers from git log
git log --raw | grep Author | sort | awk '{sub(/<.*>/,"");print $2,$3}' | uniq | sort
@iheitlager
iheitlager / gist:46cb7cb3d7e0d30fc98b
Last active August 29, 2015 14:12
Refresh Chrome from vi

In osx, there is a scripted way to refresh Chrome:

osascript -e 'tell application "Google Chrome" to reload active tab of window 1';

You can use this to refresh Chrome from vi, by mapping it to e.g. <F4>. Put this in your .vimrc

:map <F4> :! osascript -e 'tell application "Google Chrome" to reload active tab of window 1';<CR><CR>

The ! after the colon is to execute a shell script. The <CR><CR> is to automate vi further. If you do this you might find there is still an annoying "Press ENTER or type command to continue" message when closing the browser. Just add a silent and a redraw (somehow the screen screws up after a silent) and you are good to go.

@iheitlager
iheitlager / data-migrator-example1.py
Last active September 15, 2017 08:26
data-migrator sample 1
from data_migrator import models, transform
from data_migrator.emitters import MySQLEmitter
def parse_b(v):
if v == 'B':
return 'transformed_B'
else:
return v.lower()
class Result(models.Model):
@iheitlager
iheitlager / simple-migration.py
Last active September 14, 2017 20:17
Basic migration script
import sys, csv
reader = csv.DictReader(sys.stdin)
for row in reader:
print('INSERT INTO `table` (a,b) VALUES ("%(a)s", %(b)s)' % row)