Skip to content

Instantly share code, notes, and snippets.

@kcwu
kcwu / use_zfgrep.py
Last active August 29, 2015 14:07
use_zfgrep.py
import subprocess
import glob
import sys
import os
import csv
import time
import gzip
import json
import re
import re
import sys
import urlparse
import urllib
def fb_normalize(url):
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url)
q = urlparse.parse_qs(query)
if scheme == 'http':
@kcwu
kcwu / gist:6963645
Created October 13, 2013 15:38
fix portconf
.if !empty(.CURDIR:M/usr/ports*) && exists(/usr/local/libexec/portconf)
_PORTCONF!=/usr/local/libexec/portconf; echo
.for i in ${_PORTCONF:S/|/ /g}
${i:C,=.*,,g} = ${i:C,.*=%*,,:S,%, ,g}
.endfor
.endif
@kcwu
kcwu / gist:6356975
Created August 27, 2013 18:09
Install pgrest on FreeBSD -current
1. postgresql
install /usr/ports/databases/postgresql93-server/
# p.s. I haven't applied following patch.
# http://www.freebsd.org/cgi/query-pr.cgi?pr=175783
2. plv8js
git clone https://code.google.com/p/plv8js/
cd plv8js
gmake CUSTOM_CC=g++46 # if failed, reinstall gcc46
gmake CUSTOM_CC=g++46 install
@kcwu
kcwu / pack.py
Last active December 21, 2015 12:09
pack strokes
"""
run: pack unpack diff
pack:
python pack.py pack > strokes.bin
gzip -kf strokes.bin
ls -l strokes.bin*
unpack:
gzip -dc < strokes.bin.gz | python pack.py unpack > strokes.unpacked