Skip to content

Instantly share code, notes, and snippets.

@tiancheng91
tiancheng91 / redis_asyncio.py
Created July 5, 2017 03:21 — forked from yihuang/redis_asyncio.py
benchmark gevent vs asyncio on python3.4
import asyncio
import hiredis
d = {}
def process(req):
cmd = req[0].lower()
if cmd==b'set':
d[req[1]] = req[2]
return b"+OK\r\n"
@tiancheng91
tiancheng91 / gost.sh
Created June 11, 2017 11:22
gost 代理
wget https://github.com/ginuerzh/gost/releases/download/v2.3/gost_2.3_linux_amd64.tar.gz
tar -zxvf gost_2.3_linux_amd64.tar.gz
server:
gost -L=socks://:9023
local:
gost -L=ss://aes-128-cfb:123456@:8446
@tiancheng91
tiancheng91 / gspider.py
Created June 5, 2017 06:01 — forked from wolf0403/gspider.py
Gevent Spider
import gevent
import logging
import requests
try:
import simplejson as json
except:
import json
from gevent.pool import Group, Pool
@tiancheng91
tiancheng91 / factory-shared.es5.js
Created June 2, 2017 02:41 — forked from PatrickJS/factory-shared.es5.js
Different examples of OOP "class" with "inheritance" done using JavaScript including languages that transpile into js. Take notice to the amount of boilerplate that's needed in ES5 compared to ES6. These examples all have the same interface with pros/cons for each pattern. If they seem similar that's whole point especially the difference between…
var EventEmitter = require('events').EventEmitter;
var _ = require('lodash');
// Factory shared
var makePerson = function() {
var person = {};
EventEmitter.call(person);
person.wallet = 0;
_.extend(person, personMethods)
return person;
@tiancheng91
tiancheng91 / flex.css
Last active April 14, 2017 11:50
style guide
.flex {
display: flex;
flex-direction: row;
flex-wrap: wrap;
// flex-flow: row wrap;
justify-content: flex-start; // (center | flex-end) 左, 居中, 右 元素排版
justify-coutent: space-bettween;
@tiancheng91
tiancheng91 / google.cfg
Created March 23, 2017 17:37
haproxy for google
fronted google_80
mode tcp
bind 104.224.187.225:80
default_backend google_80
backend google_80
balance roundrobin
server google_80_01 172.217.4.164:80 check
server google_80_02 172.217.5.69:80:80 check
fronted google_443
@tiancheng91
tiancheng91 / host_file
Last active March 14, 2017 09:37
tinc subnet
Address = 0.0.0.0
Port = 659
Compression = 5
Subnet = 10.200.0.0/24
Subnet = 192.168.56.0/24
@tiancheng91
tiancheng91 / startup
Created February 25, 2017 08:02
sketch 基础
### 入门
https://www.youtube.com/playlist?list=PLWlUJU11tp4fEXI8deWhBQAHDv9R23WHB
### 插件
Dynamic Button
@tiancheng91
tiancheng91 / base62.py
Last active February 13, 2017 08:21
base62 encode
"""
Tiny
A reversible base62 ID obfuscater
Authors:
Jacob DeHart (original PHP version) and Kyle Bragger (Ruby port)
and Lee Semel (python port)
Usage:
obfuscated_id = to_tiny(123)
original_id = from_tiny(obfuscated_id)
Configuration:
@tiancheng91
tiancheng91 / phantomjs,yml
Created January 26, 2017 09:45
pyspider docker conf
version: '2'
services:
phantomjs:
image: 'binux/pyspider:latest'
command: phantomjs
cpu_shares: 512
environment:
- 'EXCLUDE_PORTS=5000,23333,24444'
expose:
- '25555'