Skip to content

Instantly share code, notes, and snippets.

View ninehills's full-sized avatar

Tao Yang ninehills

View GitHub Profile
@ninehills
ninehills / dict.py
Created May 7, 2010 09:48
终端下的简单词典
#!/usr/bin/python
#coding=utf8
import urllib
import sys
import re
import xml.dom.minidom as xml
API_URL = 'http://dict.cn/ws.php?utf8=true&q=%s'
#API_URL = 'http://dict-co.iciba.com/api/dictionary.php?w=%s'
def getword(word):
@ninehills
ninehills / screenshot
Created May 7, 2010 18:28
简单的屏幕截图脚本
#!/bin/bash
#屏幕截图,截取选择区域到 SCRDIR 目录
NOW=`date '+%Y-%m-%d-%H-%M-%S'`
if [ -z $2 ]; then
FNAME=screenshot-${NOW}
else
FNAME="[$2]-${NOW}"
fi
EXT=png
@ninehills
ninehills / sshgfw
Created July 30, 2010 05:03 — forked from fuckgfw/sshgfw
linux下ssh翻墙断线重连
#!/usr/bin/expect
set timeout 60
spawn /usr/bin/ssh -D 7070 -g [email protected]
#这里的 username 为你自己的用户名,yourserver.com 为你自己的服务器域名或ip
expect {
"password:" {
send "password\r"
#将第二个 password 改为你自己的密码
}
@ninehills
ninehills / server.php
Created August 9, 2010 06:08
php socket server
<?php
require("sql.php");
//确保在连接客户端时不会超时
set_time_limit(0);
//设置IP和端口号
$address = 'localhost';
$port = 2009;
@ninehills
ninehills / club12
Created August 13, 2010 00:45
在线播放12社区上的视频
#!/bin/bash
mplayer `curl $@ |egrep -o "ftp.*(rmvb|avi|mkv)"` -cache 8192
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>OLIVIDA Start Page</title>
<link rel="stylesheet" type="text/css" media="screen" href="/static/css/style.css" />
<link rel="shortcut icon" href="/static/img/favicon.ico" />
</head>
<body>
<div id="Root"><div style="float: right"><a href="https://mail.google.com/" target="_blank">Gmail</a>&nbsp; <a href="https://www.google.com/reader" target="_blank">Reader</a>&nbsp; <a href="https://www.google.com/analytics" target="_blank">Analytics</a>&nbsp; <a href="https://www.google.com/adsense" target="_blank">AdSense</a>&nbsp; <a href="https://www.instapaper.com/" target="_blank">Instapaper</a></div>
#!/usr/bin/env python
"""
A pure python ping implementation using raw socket.
Note that ICMP messages can only be sent from processes running as root.
Derived from ping.c distributed in Linux's netkit. That code is
@ninehills
ninehills / .vimrc
Created November 14, 2010 09:37
VIMRC
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 一般设定
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 设定主题
colo evening
" 设定默认解码
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
@ninehills
ninehills / snap.sh
Created November 20, 2010 10:33
Ubuntu下的截图脚本
#!/bin/bash
# Ubuntu下的截图脚本,为其设置一个快捷键即可
# 来自:http://forum.ubuntu.org.cn/viewtopic.php?f=120&t=125239
NOW=`date '+%Y-%m-%d-%H-%M-%S'`
if [ -z $2 ]; then
FNAME=screenshot-${NOW}
else
FNAME="[$2]-${NOW}"
@ninehills
ninehills / gateway.sh
Created November 23, 2010 04:58
网关登录脚本
#!/bin/bash
USER=user #账号
PASS=pass #密码
GATE=https://202.113.18.188
GATELOGOUT=https://202.113.18.188/F.htm #网关登出地址
if [ "$1" = "login" ];
then