Skip to content

Instantly share code, notes, and snippets.

View xfguo's full-sized avatar
🎯
Focusing

Xiongfei(Alex) GUO xfguo

🎯
Focusing
View GitHub Profile
@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
@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):
@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"`
@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 && \
@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>
@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 ]
@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
##############################
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)
@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'
@tuzz
tuzz / github.css
Last active April 19, 2025 21:11
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: