Skip to content

Instantly share code, notes, and snippets.

import socket
import fcntl
import struct
import os
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(s.fileno(),0x8915,struct.pack('256s', ifname[:15]))[20:24])
interface = 'eth0'
@luoshu
luoshu / README
Created June 28, 2011 15:48
ipv6 hosts
#Google和各种网站的IPv6服务hosts
#利用IPv6技术翻墙,保证Google服务可用,校园网用户使用IPv6应该不收取上网费用(至少我们学校如此)
#最下方有各种网站的IPv6hosts列表
#欢迎转载,请注明来源,谢谢
#本文的发布地址:http://docs.google.com/View?id=dfkdmxnt_61d9ck9ffq
#本文的共享链接:https://docs.google.com/View?docID=0ARhAbsvps1PlZGZrZG14bnRfOTVmZzR4NjRkdA&revision=_latest
#表格版的host列表地址:http://spreadsheets.google.com/ccc?key=0AhhAbsvps1PldEVXVzBkR3hBaWFnbEQ0OWIwMU5ycmc&hl=zh_CN
#Google IPv6 地址及对应证书列表(不再细分):https://docs.google.com/Doc?docid=0ARhAbsvps1PlZGZrZG14bnRfOTVmZzR4NjRkdA&hl=en
@luoshu
luoshu / README
Created June 23, 2011 20:25
让你的vps支持IPV6(HE.NET),使用IPV6 TunnelBroker
#=============================================================================
# FileName: ipv6
# Desc: 说明文档
# Author: luoshu
# Email: i@luoshu.me
# HomePage: http://www.luoshu.me
# Version: 0.0.1
# LastChange: 2011-06-24 04:23:29
@luoshu
luoshu / yupoo_backup.rb
Created May 19, 2011 08:37 — forked from huacnlee/yupoo_backup.rb
Yupoo 图片备份工具
# coding: UTF-8
#
# Yupoo 照片备份工具
# 此工具不需要API,直接就能备份你的照片信息,下载后以图片 + 一个文本文件的方式存放
# 备份包括内容:
# 原图,标题,说明,Tag,当然有 Exif 信息
#
# Jason Lee <huacnlee@gmail.com>
# http://huacnlee.com
# 2011-01-28
@luoshu
luoshu / gist:759424
Created December 30, 2010 03:37
Emlog Rewrite Nginx
location / {
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/(post|record|sort|author|page)-([0-9]+)\.html$ /index.php?$1=$2;
rewrite ^/(post|record|sort|author|page)/([0-9]+)$ /index.php?$1=$2;
@luoshu
luoshu / gist:759419
Created December 30, 2010 03:30
Nginx伪静态Emlog篇
location / {
if (!-f $request_filename)
{
set $rule_0 1$rule_0;
}
if (!-d $request_filename)
{
set $rule_0 2$rule_0;
}
if ($rule_0 = "21")