Skip to content

Instantly share code, notes, and snippets.

@gaotongfei
gaotongfei / ubuntu-14.04-(trusty)-aliyun-mirror
Created December 31, 2015 08:41
ubuntu 14.04 (trusty) aliyun mirror
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
@gaotongfei
gaotongfei / trusty64-download-link
Created December 31, 2015 08:38
ubuntu trusty64 vagrant box download link
@gaotongfei
gaotongfei / apt-get-http-proxy
Created December 31, 2015 03:28
use http proxy while using apt-get
sudo apt-get -o Acquire::http:proxy="http://127.0.0.1:1080" update
@gaotongfei
gaotongfei / ssh-via-socks5-proxy
Created December 28, 2015 17:14
ssh via socks5 proxy
ssh -o ProxyCommand='nc -x 127.0.0.1:1080 %h %p' username@ip
@gaotongfei
gaotongfei / 0_reuse_code.js
Created December 26, 2015 07:24
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@gaotongfei
gaotongfei / print_cookies.py
Created November 21, 2015 03:44 — forked from iiska/print_cookies.py
Using urllib2 and cookielib to print cookies from GET request
import urllib2
import cookielib
cookie_jar = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie_jar))
urllib2.install_opener(opener)
request = urllib2.Request('http://www.google.com')
urllib2.urlopen(request)
@gaotongfei
gaotongfei / PyTorStemPrivoxy.md
Created November 21, 2015 03:20 — forked from KhepryQuixote/PyTorStemPrivoxy.md
Python script to connect to Tor via Stem and Privoxy, requesting a new connection (hence a new IP as well) as desired.

Crawling Anonymously with Tor in Python

adapted from the article "Crawling anonymously with Tor in Python" by S. Acharya, Nov 2, 2013.

The most common use-case is to be able to hide one's identity using TOR or being able to change identities programmatically, for example when you are crawling a website like Google and you don’t want to be rate-limited or blocked via IP address.

Tor

Install Tor.

@gaotongfei
gaotongfei / tor.py
Created October 26, 2015 09:45 — forked from jefftriplett/tor.py
Python Requests + Tor (Socks5)
"""
setup:
pip install requesocks
super helpful:
http://packetforger.wordpress.com/2013/08/27/pythons-requests-module-with-socks-support-requesocks/
"""
import requests
import requesocks