Skip to content

Instantly share code, notes, and snippets.

@bigeagle
bigeagle / mp3_cover.py
Created February 6, 2012 05:34
fetch album cover from douban
#!/usr/bin/python2
# -*- encoding:utf8 -*-
import os
import urllib
import urllib2
import time
import re
import eyeD3
import argparse
urlread = lambda url: urllib2.urlopen(url).read()
@bigeagle
bigeagle / dnspodsh.sh
Created February 23, 2012 12:30 — forked from zrong/dnspodsh.sh
在bash中使用DNSPod的API接口实现DDNS客户端
#!/bin/bash
##############################
# dnspodsh
# 基于dnspod api构架的bash ddns客户端
# 作者:zrong(zengrong.net)
# 日期:2012-02-13
##############################
login_email=${1:?'必须提供登录名'}
@bigeagle
bigeagle / dnspod.py
Created February 23, 2012 15:28
update dns records on dnspod dynamically
#!/usr/bin/env python2
# -*- coding:utf8 -*-
# ----------------
# forked from dnspod official client
# modified by Justin Wong <bigeagle(at)xdlinux.info>
# License: MIT
# ----------------
import httplib, urllib
import socket
@bigeagle
bigeagle / dnspod.py
Created February 23, 2012 22:29
Update dnspod record dynamically
#!/usr/bin/env python2
# -*- coding:utf8 -*-
'''
* forked from dnspod's offical python script for dynamic dns record
* modified by Justin Wong <bigeagle(at)xdlinux(dot)info>
* LICENSE: MIT License
'''
import httplib, urllib
@bigeagle
bigeagle / thunet.py
Created August 13, 2012 08:42
THU net connector via web
#!/usr/bin/env python2
# -*- coding:utf8 -*-
import requests
import argparse
USERNAME=""
PASSWORD=""
BASE_URL="http://net.tsinghua.edu.cn/"
@bigeagle
bigeagle / gitmanul.md
Created October 25, 2012 16:49
Git Manual

Git 简要教程

##引言

鉴于使用Git有一点点门槛(比SVN稍微高一点),我写了个实用教程,如果想更进一步了解Git,或者觉得我写的太懶,推荐参考书 Progit,这本书是开源的,前四章就足够用了。

组内我和晓天、汤韬都会使用git,有问题可以线下直接问。

至于为什么要用Git,其实用SVN也是挺好的,但是SVN是集中式提交,同一时刻只能有一个人修改一个文件,这个在很多时候会比较蛋疼,另一方面SVN提交时要求联网,这样碰上断网什么的话SVN就废了。

@bigeagle
bigeagle / block_bad_ip.py
Created November 12, 2012 11:20
Anti gfw6's dns pollution
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import os
import sys
def ip62hex(ip):
ip = map(lambda x: int(x, 16), ip.split(':'))
hexed = reduce(list.__add__,
[[(x >> 8), (x & 0x00FF)] for x in ip])
object Main extends App{
def primes(nums: Stream[Int]): Stream[Int] =
Stream.cons(nums.head, primes(nums.tail filter (_ % nums.head > 0)))
val p = primes(Stream.from(2))
println(p apply 201314)
}
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
import tornado.ioloop
import tornado.web
import tornado.gen
import motor
import json
class PersistantHandler(tornado.web.RequestHandler):
@bigeagle
bigeagle / conky.conf
Created December 31, 2013 06:09
conky for i3-bar
### Conky configuration file
## Output is printed to the console -> i3bar
# Modified: 27.11.2011 - mseed : http://www.fastlinux.eu
# Modified: 10.09.2012 - Sagar Behere
## No output to X <yes/no>
out_to_x no
## Create own window to draw <yes/no>