Skip to content

Instantly share code, notes, and snippets.

@bigeagle
bigeagle / QuickPhrase.mb
Last active August 29, 2015 14:21
Fcitx Quick Phrase
tj ☯
' 『
' 』
" “
" ”
' ‘
' ’
0 零
1 壹
@bigeagle
bigeagle / tunet.go
Last active September 2, 2015 15:25
TUNET connector
package main
import (
"bufio"
"crypto/md5"
"crypto/rc4"
"encoding/base64"
"flag"
"fmt"
"io"
@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 / 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/"
[user]
name = bigeagle
email = justin.w.xd@gmail.com
[color]
diff = auto
status = auto
branch = auto
interactive = auto
[alias]
co = checkout
@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])
@bigeagle
bigeagle / iptables.sh
Last active December 10, 2015 02:05
sshban
iptables -N sshban
iptables -A sshban -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource
iptables -A sshban -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 --name DEFAULT --rsource -j DROP
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)
}