Skip to content

Instantly share code, notes, and snippets.

@georgexsh
georgexsh / .ctags
Last active September 18, 2017 07:50
--recurse
--links=no
--fields=+n
--exclude=*.js
--exclude=*.html
--exclude=venv/*
--langmap=python:+.ptl
--regex-python=/^ *([_A-Z0-9]+)[\t ]*=/\1/d,definition/e
--python-kinds=-i
--php-kinds=-v
diff -r 9652cdeba438 mako/pyparser.py
--- a/mako/pyparser.py Wed May 16 10:38:44 2012 -0400
+++ b/mako/pyparser.py Tue Jun 19 03:44:07 2012 +0800
@@ -66,7 +66,7 @@
def __init__(self, listener, **exception_kwargs):
self.in_function = False
self.in_assign_targets = False
- self.local_ident_stack = {}
+ self.local_ident_stack = set()
2012-06-22 15:15:43 [27974] [INFO] Booting worker with pid: 27974
2012-06-22 15:15:43 [27975] [INFO] Booting worker with pid: 27975
2012-06-22 15:15:43 [27868] [INFO] killing worker 27922 with 3
2012-06-22 15:15:43 [27868] [INFO] killing worker File "gunicorn_dev_server.py", line 36, in <module>
main()
2012-06-22 15:15:43 [27868] [INFO] killing worker File "gunicorn_dev_server.py", line 32, in main
ShireApplication("%prog [OPTIONS] APP_MODULE").run()
2012-06-22 15:15:43 [27868] [INFO] killing worker File "/home/xieshi/dev/gunicorn/app/base.py", line 129, in run
Arbiter(self).run()
2012-06-22 15:15:43 [27868] [INFO] killing worker File "/home/xieshi/dev/gunicorn/arbiter.py", line 177, in run
@georgexsh
georgexsh / gist:3103741
Created July 13, 2012 08:51
clean subtree svn:mergeinfo
find -mindepth 1 | grep -v '\.svn' | while read d; do svn pl "$d" | grep 'svn:mergeinfo' > /dev/null && echo $d; done
@georgexsh
georgexsh / gist:3141684
Created July 19, 2012 08:55
simple launchy plugin, convert timestamp to date
// A simple plugin, convert timestamp to date
// [email protected]
// 2008-8-8
// Under WTFPL
#include "stdafx.h"
#include "LaunchyPlugin.h"
#include "time.h"
#include <sstream>
@georgexsh
georgexsh / wo_jiu_yao_guangbo.js
Last active October 12, 2015 17:58
修改豆瓣logo指向为友邻广播
// ==UserScript==
// @name Douban update
// @description haha
// @author georgexsh
// @include http://*.douban.com/*
// @version 0.20
// @encoding utf-8
// ==/UserScript==
(function () {
@georgexsh
georgexsh / gist:5212626
Last active December 15, 2015 05:59
simple benchmark
import re
from timeit import timeit
def str_replace(s):
"""legacy HTML escape for non-unicode mode."""
s = s.replace("&", "&amp;")
s = s.replace(">", "&gt;")
s = s.replace("<", "&lt;")
import sys
from gunicorn import util
from gunicorn.app.base import Application
def make_tb_echo_app(exc):
def app(environ, start_response):
exc_type, exc_value, exc_info = exc
# TODO logging the exception or re-raise
return app
commit d264be90f3605f19e903e96e25c8d1d7c15969ca
Author: Xie Shi <[email protected]>
Date: Mon Jul 14 13:50:38 2014 +0800
convert object w/ an unknown type into string repr
ref: https://github.com/getsentry/raven-python/issues/474
diff --git a/raven/utils/json.py b/raven/utils/json.py
index 654f019..901e9d2 100644
@georgexsh
georgexsh / nginx_conf_gc.py
Created June 12, 2015 08:05
find useless nginx config files
import os
import glob
import re
all_files = set()
for dirpath, dirnames, filenames in os.walk('.'):
for f in filenames:
dirnames[:] = [d for d in dirnames if not d.startswith('.git')]
f = os.path.join(dirpath, f)