Skip to content

Instantly share code, notes, and snippets.

#! /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"
@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
" 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 / 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:
@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 / sandbox.py
Last active December 27, 2015 07:19
simple wsgi sandbox
import urlparse
import sys
def app(env, start_response):
status = '200 OK'
start_response(status, [])
if env['REQUEST_METHOD'] != 'POST':
template = '''
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
import dev_appserver
dev_appserver.fix_sys_path()
def get_auth():
import getpass
return raw_input('Username:'), getpass.getpass('Password:')
def connect(app_id):
from google.appengine.ext.remote_api import remote_api_stub
一次決, 第二投標價得標, 最邪惡的地方在於..
你投標 只能決定你想要在得標的價格最高為多少..並不會直接影響得標金額
只要你覺得這次投標有這個價值.. 就可以直接投你的心裡底價, 不用再猶豫說這價錢會高別人太多..
利差就在於你的心裡底價 和 其他人的心理底價的差距
感覺這機制很棒, 因為每次得標都可以用合理的價錢來得標..不會因為自己對於這標過度高估, 有過度的損失..
teddy 說, 別人會把價錢拉上來..這觀點我覺得不對..每個人都會有最高價限制.
@georgefs
georgefs / test.py
Last active December 24, 2015 13:59
simple test
try:
from cStringIO import StringIO
except:
from io import StringIO
from datetime import datetime
def test_join():
data = []
for i in range(1000000):
data.append(str(i))
@georgefs
georgefs / copycat.mkd
Created September 22, 2013 10:48
description how to bindkey on your env

bash

~/.inputrc or /etc/.inputrc

"^V": "copycat "

zsh