This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#/ Usage: clean-merged-branches [-f] | |
#/ Delete merged branches from the origin remote. | |
#/ | |
#/ Options: | |
#/ -f Really delete the branches. Without this branches are shown | |
#/ but nothing is deleted. | |
#/ -n Dry-run, only show what would be removed. | |
set -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION escape_json (text) RETURNS text AS $$ | |
SELECT replace($1, '''', '\'''); $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(text) RETURNS text AS $$ | |
SELECT escape_json($1) $$ LANGUAGE SQL IMMUTABLE; | |
CREATE OR REPLACE FUNCTION to_json(KEY text, value text) RETURNS text AS $$ | |
SELECT '''' || to_json($1) || ''': ''' || to_json($2) || ''''; $$ LANGUAGE SQL IMMUTABLE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If we're not in screen, resume the existing session | |
if [[ "$TERM" != screen* ]]; then | |
# Clean up old sessions | |
screen -wipe > /dev/null | |
# See if there are sessions available | |
screen -q -ls | |
if [[ "$?" -ge "10" ]]; then | |
# Reconnect if there are | |
exec screen -x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
global-gc = !git-global-gc.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function auto_activate(){ | |
name=$(basename "$PWD") | |
project_dir="$HOME/workspace/$name" | |
env_dir="$HOME/envs/$name" | |
if [ -d "$env_dir" ]; then | |
workon "$name" | |
fi | |
} | |
auto_activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
import subprocess | |
import fileinput | |
os.chdir(os.path.dirname(__file__)) | |
process = subprocess.Popen( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int a(){ | |
return 42; | |
} | |
double b(){ | |
return 3.141592653589793; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gevent.local import local | |
from gevent.pywsgi import WSGIServer | |
from gevent import monkey | |
import socket | |
import pprint | |
import sys | |
def application(environ, start_response): | |
url = environ['PATH_INFO'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source=$1 | |
dest=$2 | |
snapshot=$3 | |
size=$(zfs send -nP $source@$snapshot 2>&1 | grep size | awk '{print $2}') | |
echo "$source@$snapshot -> $dest: $size" | |
zfs send $source@$snapshot | pv --timer --progress --eta --rate --average-rate --bytes --size $size --cursor --name $source | zfs receive -Fvu $dest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
function image_all(){ | |
echo "Processing $1" | |
test -d "$1" || return 1 | |
cd "$1" | |
for i in *; do | |
if [ "$i" == "utils" ]; then | |
continue |
OlderNewer