Skip to content

Instantly share code, notes, and snippets.

@georgefs
georgefs / urlib.js
Last active December 29, 2015 03:58
簡單的js url encode & decode
function serialize(obj) {
var str = [];
for(var p in obj)
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
return str.join("&");
}
function parse_qs(qs){
qs.replace(/^.*\?|#.*$/g, '');
@georgefs
georgefs / mutiprocess.py
Created December 4, 2013 04:00
python simple multi process demo
from multiprocessing import Pool
def fun(x):
print x
if __name__ == '__main__':
pool = Pool(processes=5)
with open('log', 'r+') as f:
for line in f:
" Dim inactive windows using 'colorcolumn' setting
" This tends to slow down redrawing, but is very useful.
" Based on https://groups.google.com/d/msg/vim_use/IJU-Vk-QLJE/xz4hjPjCRBUJ
" XXX: this will only work with lines containing text (i.e. not '~')
function! s:DimInactiveWindows()
for i in range(1, tabpagewinnr(tabpagenr(), '$'))
let l:range = ""
if i != winnr()
if &wrap
" HACK: when wrapping lines is enabled, we use the maximum number
@georgefs
georgefs / mongo.sh
Created December 10, 2013 14:49
init.d
#!/bin/bash
PID_FILE=/var/run/mongo.pid
MONGOD=/opt/mongodb-linux-x86_64-2.0.6/bin/mongod
###
# main point
###
case "$1" in
#! /bin/bash
#
# docker.sh
# Copyright (C) 2015 george.li <vagrant@vagrant-ubuntu-trusty-64>
#
# Distributed under terms of the MIT license.
#
img="tagtoo/quick-env"