Skip to content

Instantly share code, notes, and snippets.

View xfguo's full-sized avatar
🎯
Focusing

Xiongfei(Alex) GUO xfguo

🎯
Focusing
View GitHub Profile
@niwinz
niwinz / geventfd.py
Created June 16, 2012 07:57 — forked from wolever/geventfd.py
Simple wrapper around a file descriptor which will perform non-blocking reads/writes using gevent
import os
import fcntl
from gevent.core import wait_read, wait_write
class GeventFD(object):
""" Wrap a file descriptor so it can be used for non-blocking reads and writes with gevent.
>>> stdin = GeventFD(sys.stdin.fileno())
>>> stdin.read(5)
'hello'
diff -r 273fbf501965 src/gui.c
--- a/src/gui.c Mon Apr 30 21:09:43 2012 +0200
+++ b/src/gui.c Tue May 01 19:32:14 2012 +0900
@@ -270,6 +270,12 @@
}
/* Child */
+#ifdef FEAT_GUI_GTK
+ /* Call gtk_init_check() here. See gui_init_check(). */
+ if (gui_mch_init_check() != OK)
@zrong
zrong / dnspodsh.sh
Last active February 18, 2025 07:30
在bash中使用DNSPod的API接口实现DDNS客户端
#!/bin/bash
##############################
# dnspodsh v0.3
# 基于dnspod api构架的bash ddns客户端
# 作者:zrong(zengrong.net)
# 详细介绍:http://zengrong.net/post/1524.htm
# 创建日期:2012-02-13
# 更新日期:2012-03-11
##############################
@DP6
DP6 / Usage
Created December 9, 2011 13:27 — forked from alexmacedo/Usage
Virtualenv bootstrap script to create a Django environment
$ python generate_bootstrap.py bootstrap_base.py > django-bootstrap.py
$ python django-bootstrap.py ENV --project=NAME [ --hg --git --mysql --south --fabric --nose ]
@HarryR
HarryR / zmqstub.c
Created September 23, 2011 13:34
zmq & libevent stub
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <libgen.h>
#include <signal.h>
#include <err.h>
#include <assert.h>
#include <zmq.h>
@alexsparrow
alexsparrow / sconsenv.sh
Created July 5, 2011 10:26
Script to setup scons in private area via virtualenv
#!/bin/sh
echo ">> Downloading virtualenv..." && \
wget http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.6.4.tar.gz#md5=1072b66d53c24e019a8f1304ac9d9fc5 && \
echo ">> Extracting..." && \
tar -xvzf virtualenv-1.6.4.tar.gz && \
echo ">> Creating '.pythondir'..." && \
mkdir .pythondir && \
cd virtualenv-1.6.4 && \
echo ">> Installing virtualenv..." && \
python setup.py install --prefix ../.pythondir && \
@chuangbo
chuangbo / README.md
Last active February 18, 2025 07:30
Python dynamic DNSPod DNS Script

替换上你的 API Token,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获取 API Token 的方式

获得 domain_id 可以用 curl

curl -k https://dnsapi.cn/Domain.List -d "login_token=TOKEN"`
@parente
parente / setup_tornadoenv.py
Created January 3, 2011 02:25
Create a virtualenv for a Tornado app
#!/usr/bin/env python
'''
Setup a virtualenv with tornado/master and a run script to serve static files.
'''
import virtualenv
import os
import subprocess
import stat
def after_install(options, home_dir):
@nrk
nrk / gist:31175
Created December 2, 2008 16:53
A function in Lua similar to PHP's print_r
-- A function in Lua similar to PHP's print_r, from http://luanet.net/lua/function/print_r
function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then