This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"code.google.com/p/go.crypto/ssh" | |
"code.google.com/p/go.crypto/ssh/terminal" | |
"crypto" | |
"crypto/x509" | |
"crypto/rsa" | |
"encoding/pem" | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func pusher(ch chan string, data string, count int) { | |
for count > 0 { | |
ch <- data | |
count -= 1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"log" | |
"net" | |
) | |
var bind = flag.String("bind", "127.0.0.1:6666", "ip:port to bind") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//GAE app的主体 | |
package hello | |
import ( | |
"appengine" | |
"appengine/urlfetch" | |
"bytes" | |
"encoding/gob" | |
"io" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type Func func(int) int | |
func (f *Func) test(q int) int { | |
return (*f)(q + 1) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/resource.h> | |
#include <sys/wait.h> | |
#include <signal.h> | |
int pid; | |
void sig_handler(int sig) { | |
if (pid > 0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from socket import * | |
def client(): | |
sock = socket(AF_INET, SOCK_STREAM) | |
sock.connect(('127.0.0.1', 7777)) | |
sock.close() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from socket import * | |
import select | |
import struct | |
import errno | |
streams = {} # fileno -> Socks5Handler |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import partial | |
import click | |
def class_group(name=None, parent=click, **group_args): | |
def dec(cls): | |
attrs = dir(cls) | |
group_name = name or getattr(cls, '__cmd__', None) \ | |
or cls.__name__.lower() | |
group = parent.group(group_name, **group_args)(cls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
from collections import defaultdict | |
from sqlalchemy import create_engine | |
class Env(object): | |
def __init__(self, model='.db.Model', types='sqlalchemy.types', | |
column='sqlalchemy.Column', fix_onupdate=True): | |
self.model = model.rsplit('.', 1)[-1] |