Skip to content

Instantly share code, notes, and snippets.

View fengsi's full-sized avatar
🐍
3.12

Si Feng fengsi

🐍
3.12
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fengsi on github.
  • I am fengsi (https://keybase.io/fengsi) on keybase.
  • I have a public key whose fingerprint is 76C2 7391 7B0A 5405 8F5B 2BCA 2E8B B0C7 9999 9999

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am fengsi on github.
* I am fengsi (https://keybase.io/fengsi) on keybase.
* I have a public key whose fingerprint is 32D2 5874 0778 922C 1404 ECDA 5A19 B7A8 9999 9ABC
To claim this, I am signing this object:
@fengsi
fengsi / gist:1531537
Created December 29, 2011 03:18
xe-guest-utilities IP address patch for Arch Linux
--- src.orig/usr/sbin/xe-update-guest-attrs 2011-12-28 21:05:13.055346917 -0600
+++ src/usr/sbin/xe-update-guest-attrs 2011-12-28 21:04:02.545354603 -0600
@@ -151,9 +151,9 @@
# 3: sit0: <NOARP> mtu 1480 qdisc noop
# link/sit 0.0.0.0 brd 0.0.0.0
-#eval $(ip addr show | \
-# sed -n -e 's/^[[:digit:]]*: \([a-z0-9]*\): .*/ifs="\$ifs \1"; current="\1"; /gp;' \
-# -e 's/^[[:space:]]\{4\}inet \('${IPADDR_RE}'\)\/.*/eval inet_\${current}="\1"; /gp;')
+eval $(ip addr show | \
@fengsi
fengsi / gist:1033041
Created June 18, 2011 12:17
my own urllib2 gzip hack
import urllib2, zlib
def get_page(url):
opener = urllib2.build_opener()
opener.addheaders = [('Accept-Encoding', 'gzip')]
data = opener.open(url).read()
try:
decompress_data = zlib.decompress(data, 16+zlib.MAX_WBITS)
except zlib.error:
return data
@fengsi
fengsi / south
Created May 25, 2011 06:47
south error for userena
runnerw.exe D:/Python27/python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.2.1\helpers\pycharm\django_manage.py" syncdb
Importing Django settings module settings
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 1.2.1\helpers\pycharm\django_manage.py", line 19, in <module>
run_module(manage_file, None, '__main__')
File "D:\Python27\lib\runpy.py", line 180, in run_module
fname, loader, pkg_name)
File "D:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\Dropbox\PycharmProjects\demo_project\manage.py", line 15, in <module>