Skip to content

Instantly share code, notes, and snippets.

View tclh123's full-sized avatar
💭
Be an artist

Harry Lee tclh123

💭
Be an artist
View GitHub Profile
@4000000056d9342114814674 192.168.20.138:55734 - - [04/Mar/2016 15:07:03] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d9342d008673ec 192.168.20.139:39386 - - [04/Mar/2016 15:07:15] "HTTP/1.1 GET /command/check_daemontools_service" - 200 OK
@4000000056d9340739036bbc 192.168.32.14:36057 - - [04/Mar/2016 15:06:37] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d93420084e6184 192.168.32.28:57917 - - [04/Mar/2016 15:07:02] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d934980b43acb4 192.168.32.28:57937 - - [04/Mar/2016 15:09:02] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d934991465179c 192.168.20.138:57595 - - [04/Mar/2016 15:09:03] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d934321ee92b7c 192.168.32.14:37492 - - [04/Mar/2016 15:07:20] "HTTP/1.1 GET /command/check_ps" - 200 OK
@4000000056d934bd189cc224 192.168.32.14:42102 - - [04/Mar/2016 15:09:39] "HTTP/1.1 GET /command/uptime" - 200 OK
@4000000056d9345b2949446c 192.168.32.28:57927 - - [04/Mar/2016 15:08:01] "HTTP/1.1 GET /command/
@tclh123
tclh123 / statsd_client.py
Last active December 11, 2015 02:52
from statsd examples
# Steve Ivy <[email protected]>
# http://monkinetic.com
from random import random
from socket import socket, AF_INET, SOCK_DGRAM
class StatsdClient(object):
SC_TIMING = "ms"
SC_COUNT = "c"
SC_GAUGE = "g"
@tclh123
tclh123 / surge.conf
Created October 27, 2015 02:44 — forked from soffchen/surge.conf
surge.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 1.0.0.0/9, 1.160.0.0/11, 1.192.0.0/11, 10.0.0.0/8, 14.0.0.0/11, 14.96.0.0/11, 14.128.0.0/11, 14.192.0.0/11, 27.0.0.0/10, 27.96.0.0/11, 27.128.0.0/9, 36.0.0.0/10, 36.96.0.0/11, 36.128.0.0/9, 39.0.0.0/11, 39.64.0.0/10, 39.128.0.0/10, 42.0.0.0/8, 43.224.0.0/11, 45.64.0.0/10, 47.64.0.0/10, 49.0.0.0/9, 49.128.0.0/11, 49.192.0.0/10, 54.192.0.0/11, 58.0.0.0/9, 58.128.0.0/11, 58.192.0.0/10, 59.32.0.0/11, 59.64.0.0/10, 59.128.0.0/9, 60.0.0.0/10, 60.160.0.0/11, 60.192.0.0/10, 61.0.0.0/10, 61.64.0.0/11, 61.128.0.0/10, 61.224.0.0/11, 100.64.0.0/10, 101.0.0.0/9, 101.128.0.0/11, 101.192.0.0/10, 103.0.0.0/10, 103.192.0.0/10, 106.0.0.0/9, 106.224.0.0/11, 110.0.0.0/7, 112.0.0.0/9, 112.128.0.0/11, 112.192.0.0/10, 113.0.0.0/9, 113.128.0.0/11, 113.192.0.0/10, 114.0.0.0/9, 114.128.0.0/11, 114.192.0.0/10, 115.0.0.0/8, 116.0.0.0/8, 117.0.0.0/9, 117.128.0.0/10, 118.0.0.0/11, 118.64.0.0/10, 118.128.0.0/9, 119.0.
@tclh123
tclh123 / tornado_http_proxy
Last active August 29, 2015 14:26
HTTP CONNECT proxy
#!/usr/bin/python
# -*- coding: utf-8 -*-
import tornado.httpserver
import tornado.ioloop
import tornado.iostream
import socket
class ProxyHandler(object):
@tclh123
tclh123 / ctags
Last active August 29, 2015 14:09 — forked from trlinkin/ctags
--- In your ~/.ctags
--langdef=puppet
--langmap=puppet:.pp
--regex-puppet=/^import[ \t]*[\'\"]?([\.a-zA-Z0-9_\-]+)[\'\"]?[ \t]*/\1/i,import/
--regex-puppet=/^class[ \t]*([:a-zA-Z0-9_\-]+)[ \t]*/\1/c,class/
--regex-puppet=/^site[ \t]*([a-zA-Z0-9_\-]+)[ \t]*/\1/s,site/
--regex-puppet=/^node[ \t]*[\'\"]?([\.a-zA-Z0-9_\-]+)[\'\"]?[ \t]*/\1/n,node/
--regex-puppet=/^define[ \t]*([:a-zA-Z0-9_\-]+)[ \t]*/\1/d,definition/
--regex-puppet=/^[ \t]*\$([\.a-zA-Z0-9_\-]+)[ \t]*=.*/\1/v,variable/
@tclh123
tclh123 / httpdump
Last active August 29, 2015 14:07 — forked from thomd/httpdump
# Monitor HTTP requests being made from your machine with a one-liner..
# Replace "en1" below with your network interface's name (usually en0 or en1)
sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"
# OR.. to be able to use as "httpdump" from anywhere, drop this into ~/.bash_profile:
# (again replace "en1" with correct network interface name)
alias httpdump='sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E "Host\: .*|GET \/.*"'
# All the above tested only on OS X.
import httplib
import ssl
import socket
import sys
import urllib2
class HTTPSConnectionV3(httplib.HTTPSConnection):
def __init__(self, *args, **kwargs):
httplib.HTTPSConnection.__init__(self, *args, **kwargs)
//author: Sun, Junyi (weibo.com/treapdb)
//usage: node --nouse-idle-notification --expose-gc --max-old-space-size=8192 memcached.js
var config ={
port: 11211,
max_memory: 300 // default 100M bytes
}
var net = require('net');
var LRU = function (max) { // this LRU implementaion is based on https://github.com/chriso/lru
@tclh123
tclh123 / .ackrc
Created January 13, 2014 13:19 — forked from kevinold/.ackrc
#ack is a tool like grep, designed for programmers with large trees of heterogeneous source code
#to install ack, see http://betterthangrep.com/
#to use ack, launch terminal (mac osx) and type 'ack <some_keywords>'
#ack will search all files in the current directory & sub-directories
#here's how I have my config file setup. this file is located on mac osx here
# ~/.ackrc
# Always sort the files

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: