Skip to content

Instantly share code, notes, and snippets.

@kols
kols / master.vim
Created January 30, 2014 16:35 — forked from gmccreight/master.vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
#!/usr/local/bin/python
import json
import sys
import keyring
import requests
APP_NAME = 'jira'
USERNAME = 'qilong.dou'
@kols
kols / -
Created March 5, 2015 10:14
Installing collected packages: thriftpy, eleme-zeus-client, cython
Running setup.py install for thriftpy
/srv/virtualenvs/earthshakerenv/local/lib/python2.7/site-packages/setuptools/dist.py:293: UserWarning: The version specified ('0.1.15.tracking') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
building 'thriftpy.transport.cytransport' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c thriftpy/transport/cytransport.c -o build/temp.linux-x86_64-2.7/thriftpy/transport/cytransport.o
x86_64-linux-gnu-gcc: error: thriftpy/transport/cytransport.c: No such file or directory
x86_64-linux-gnu-gcc: fatal error: no input files
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 4
go test ./pkg/... ./cmd/... -race
? github.com/wandoulabs/codis/pkg/env [no test files]
2015/05/28 18:15:51 action_test.go:36: [info] test proxy offline when waiting action response 
2015/05/28 18:15:54 action.go:132: [error] proxies didn't responed: [3 1 2] 
2015/05/28 18:15:54 action.go:137: [error] mark proxy 3 to PROXY_STATE_MARK_OFFLINE
2015/05/28 18:15:54 proxy.go:192: [info] mark_offline, check proxy status: 3 &{3 0 offline 0 } <nil> 
2015/05/28 18:15:54 proxy.go:200: [info] proxy: 3 offline success! 
2015/05/28 18:15:54 action.go:137: [error] mark proxy 1 to PROXY_STATE_MARK_OFFLINE
2015/05/28 18:15:54 proxy.go:192: [info] mark_offline, check proxy status: 1 &{1 0 offline 0 } <nil> 
2015/05/28 18:15:54 proxy.go:200: [info] proxy: 1 offline success! 
@kols
kols / Doppelgänger
Created May 21, 2011 12:30
关于『Doppelgänger』
(游戏 Persona 2)片头文字引用自海涅的诗『Der Doppelgänger』远山一行译的日文版
静けき夜 巷は眠る
この家に 我が恋人はかつて住み居たり
彼の人は この街すでに去りませど
そが家は いまもここに残りたり
一人の男そこに立ち 高きを見やり
手は大いなる苦悩と闘うと見ゆ
@kols
kols / LICENSE.txt
Created September 28, 2011 15:30 — forked from p01/LICENSE.txt
Sudoku Solver in 140bytes
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Mathieu 'p01' Henri <http://www.p01.org/releases/>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kols
kols / play_flash.rb
Created October 16, 2011 11:00
Play the flash video loading in your browser using a movie player
#!/usr/bin/env ruby
# Play the flash video loading in your browser using a movie player
PLAYER = 'mplayer -zoom' # your favorite player
def get_flash_file_path
pat = %r(^.*?(\d+).*?(\d+).*$)
`lsof /tmp | grep Flash` =~ pat
pid, fd = $~[1], $~[2]
"/proc/#{pid}/fd/#{fd}"
@kols
kols / conv_hexstr.rb
Created June 26, 2012 18:22
Convert hex string to ruby string
#!/usr/bin/env ruby
def convert_hexstr(str, start=0, index=nil)
index ||= str.length
hexstr = str[start, index]
ar = []
hexstr.scan(/\\x../).each do |s|
ar << s.gsub('\\', '0').to_i(16)
end
ar.empty? ? str : ar.pack('C*').force_encoding('utf-8')
@kols
kols / django_ext.py
Created September 14, 2012 06:37
ipython django extension
"""If we're working with a Django project, set up the environment
"""
import os
def load_ipython_extension(ipython):
try:
import django
except ImportError:
return
@kols
kols / compress.py
Created December 11, 2012 04:20
Compress and upload image using PIL and fabric
import argparse
import os
import sys
from PIL import Image
OUTPUT_DIR = 'output'
OUTPUT_SIZE = (3000, 1500)