Skip to content

Instantly share code, notes, and snippets.

View littleq0903's full-sized avatar
🎱
Wanna see some magic?

CoColin littleq0903

🎱
Wanna see some magic?
View GitHub Profile
@littleq0903
littleq0903 / littleq-public.pub
Created May 1, 2013 15:42
LittleQ's Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAph+uncJCYiEAzsCAKrPRhZD3atfnondg48lCehjniqOetW1N4+uQL4zVSNEScUuBC5fzwZJdAeeOO8+pnqEqmUCjrqEUb5c/hq8mznRVeuu8fMc9FwK+LPRXAZil/OMayAniZgY+jgZ/vl58Oz8ZQAzeng10UjB9k5hE+8eOLz+BOZxWCPgcZgivKXuRcn+ufNvTXkjnIaXmU5XXlrFvJxyLqzB7EnfzmlUTg37Mdi1t0BSyESAPE6C+yRpgDl3E9wcYiAZzpCuXXPOTxpY6P9v1Ohilg0Q0BoExlAkcdGLsBL1/maRlvn1V4tRgnysB/7UFJpdGgC6zwnl2hSrozw== littleq0903@gmail.com
@littleq0903
littleq0903 / pb_linux.sh
Created September 17, 2013 09:11
pbcopy/pbpaste simulation in linux
sudo apt-get install xclip
alias pbcopy="xclip -selection clipboard -i"
alias pbpaste="xclip -selection clipboard -o"
#!/bin/bash -e
#
# Purpose: Pack a Chromium extension directory into crx format
if test $# -ne 2; then
echo "Usage: crxmake.sh <extension dir> <pem path>"
exit 1
fi
dir=$1
@littleq0903
littleq0903 / join_and_concat.py
Created October 3, 2013 13:10
Proof of Python's join is faster than string concatenation.
>>> a = ["a","b","c"]
>>> def A():
... return a[0]+a[1]+a[2]
...
>>> def B():
... return "".join(a)
...
>>> import dis
>>> dis.dis(A)
2 0 LOAD_GLOBAL 0 (a)
[true,{"bgcolor":null,"logo_url":null,"ad":[{"advertiser_id":98,"image_url":"//lh6.ggpht.com/4mIpSg5abTXtw5p2TGC7AoEah9Qd7iHhRbcEBTn6oxzghzuC--9SJY3_biJwX3ZeVhuxNhpWdzYp654SYhdD2g=s200-c","store_price":"","link":"http://www.mo-bo.com.tw/PDContent.asp?yano=03040053","description":"\u7c21\u7d04\u8212\u9069\u3002\u4f11\u9592\u751f\u6d3b\u3002\u53f0\u7063\u7db2\u8def\u4f11\u9592\u570b\u6c11\u670d\u98fe\u54c1\u724c\uff0cMO-BO\u4ee5\u201d\u5929\u7136\u8212\u9069\u6750\u8cea\u201d\u3001\u201d\u7c21\u7d04\u526a\u88c1\u201d\u548c\u201d\u4f11\u9592\u751f\u6d3b\u201d\u7d50\u5408\u7684\u6982\u5ff5\uff0c\u6253\u9020\u81ea\u7531\u642d\u914d\u4e26\u4e14\u591a\u8b8a\u63db\u7684\u7a7f\u8457\u3002\u9019\u500b\u54c1\u724c\uff0c\u7528\u4e09\u5341\u5e74\u88fd\u9020\u6210\u8863\u7684\u7d93\u9a57\u5ef6\u7e8c\u51fa\u4f86\u3002\u50b3\u627f\u4e0a\u4e00\u4ee3\u7522\u696d\u7684\u65b0\u7d44\u5408\uff1b\u8001\u7522\u696d\uff0c\u65b0\u901a\u8def\uff0c\u6211\u5011\u63d0\u4f9b\u66f4\u5b8c\u7f8e\u8207\u7cfb\u7d71\u5316\u7684\u670d\u52d9\uff0c
@littleq0903
littleq0903 / test.py
Created October 31, 2013 03:56 — forked from georgefs/test.py
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))
static PyObject *
string_concatenate(PyObject *v, PyObject *w,
PyFrameObject *f, unsigned char *next_instr)
{
/* This function implements 'variable += expr' when both arguments
are strings. */
Py_ssize_t v_len = PyString_GET_SIZE(v);
Py_ssize_t w_len = PyString_GET_SIZE(w);
Py_ssize_t new_len = v_len + w_len;
if (new_len < 0) {
import json
import logging
from google.appengine.ext import db
from google.appengine.api import users
import webapp2
# With routes like:
#app = webapp2.WSGIApplication([
# webapp2.Route("/d/<collection>", DataHandler, methods=["GET", "POST"]),
# webapp2.Route("/d/<collection>/<id>", DataHandler, methods=["GET", "PUT", "DELETE"]),
[submodule "zsh-syntax-highlighting"]
path = zsh-syntax-highlighting
url = git://github.com/zsh-users/zsh-syntax-highlighting.git