Skip to content

Instantly share code, notes, and snippets.

});
});
});
});
});
@clowwindy
clowwindy / ssl.md
Last active April 26, 2024 03:04
为什么不应该用 SSL 翻墙

SSL 设计目标:

  1. 防内容篡改
  2. 防冒充服务器身份
  3. 加密通信内容

而翻墙的目标:

  1. 不被检测出客户端在访问什么网站
  2. 不被检测出服务器在提供翻墙服务
@clowwindy
clowwindy / tornado_http_proxy
Created July 8, 2013 09:05
HTTP CONNECT proxy
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.httpserver
import tornado.ioloop
import tornado.iostream
import socket
class ProxyHandler(object):
#!/bin/bash
#
# /etc/rc.d/init.d/supervisord
# supervisord This shell script takes care of starting and stopping
# supervisord. Tested on CentOS 5.
#
# Author: Brian Bouterse bmbouter@gmail.com
# Modified: @clowwindy
#
# chkconfig: 345 80 80
@clowwindy
clowwindy / gist:5909629
Created July 2, 2013 14:10
test server
{
"server":"209.141.36.62",
"server_port":8348,
"local_port":1080,
"password":"$#HAL9000!",
"timeout":600,
"method":"aes-256-cfb"
}
var net = require('net');
var data = Array(1024).join(' ');
function go() {
var s = null;
s = net.connect(8000, '127.0.0.1', function() {
setInterval(function() {
console.log(s.write(data));
}, 1000);
});
$ ./server -p 8388 -k foobar &
2013-01-04 16:34:01 INFO: Shadowsocks Version:0.1 libuv(0.9) Written by Dndx(idndx.com)
2013-01-04 16:34:01 INFO: Encrypt and decrypt table generated
2013-01-04 16:34:01 INFO: Listening on 0.0.0.0:8388
$ python local.py -k foobar &
2013-01-04 16:34:13 INFO starting server at port 1080 ...
$ curl -v www.baidu.com --socks5-hostname 127.0.0.1:1080
2013-01-04 16:34:37 INFO: Accepted connection from 127.0.0.1
2013-01-04 16:34:37 INFO: addrtype unknown, closing
public class test {
public static int fib(int n) {
if (n < 2) {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
public static void main(String[] args) {
@clowwindy
clowwindy / test2-no-sib.s
Created September 28, 2012 06:42
-fno-optimize-sibling-calls
.file "test.c"
.text
.p2align 4,,15
.globl fibonacci
.type fibonacci, @function
fibonacci:
.LFB11:
.cfi_startproc
movq %rbx, -48(%rsp)
movq %rbp, -40(%rsp)
@clowwindy
clowwindy / node-websockets.js
Created September 24, 2012 11:30
node websockets
var srv = http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
srv.on('upgrade', function(req, socket, head) {
socket.write('HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'Upgrade: WebSocket\r\n' +
'Connection: Upgrade\r\n' +
'\r\n');