Skip to content

Instantly share code, notes, and snippets.

@nneonneo
nneonneo / socks-proxy-simple.py
Created July 17, 2019 19:41 — forked from WangYihang/socks-proxy-simple.py
A simple socks server via python - updated for Pythonista (iOS)
#!python2
# -*- coding: utf-8 -*-
# 一个简单的 Socks5 代理服务器 , 只有 server 端 , 而且代码比较乱
# 不是很稳定 , 而且使用多线程并不是 select 模型
# Author : WangYihang <[email protected]>
import socket
import threading
import sys
@josephspurrier
josephspurrier / httprouterwrapper.go
Last active April 13, 2017 16:08
Golang - Making julienschmidt/httprouter compatible using gorilla/context
// Source: http://nicolasmerouze.com/guide-routers-golang/
// Package httprouterwrapper allows the use of http.HandlerFunc compatible funcs with julienschmidt/httprouter
package httprouterwrapper
import (
"net/http"
"github.com/gorilla/context"
"github.com/julienschmidt/httprouter"
@vlucas
vlucas / pre-push.sh
Created July 22, 2014 16:12
Prevent Pushes Directly to Master
#!/bin/bash
# @link https://gist.github.com/mattscilipoti/8424018
#
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
@dlo
dlo / update_github_issues.sh
Last active December 12, 2015 10:39
Make the default GitHub issue labels a little nicer.
function getpassword() {
# Written for Mac OS X Keychain.
SERVICE=$1
ACCOUNT=$2
security find-internet-password -s $SERVICE -a $ACCOUNT -w | tr -d '\n'
}
function update_github_issues() {
read -p "Enter the repo owner: " OWNER
read -p "Enter the repo name: " REPO
@mekarpeles
mekarpeles / gist:3408081
Created August 20, 2012 21:30
Python 2.7 Performance Comparison: list concatenation (+) vs list.extend()
mek@bigbertha:~/7-Projects$ python
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> def test():
... """Comapring concat. + vs list.extend"""
... x = range(10000000)
... y = range(10000000)
... x0 = time.clock()
@playpauseandstop
playpauseandstop / gist:1818351
Created February 13, 2012 17:08
Logout all active Django sessions
import datetime
from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.contrib.sessions.models import Session
from django.http import HttpRequest
from django.utils.importlib import import_module