⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains hidden or 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
#!/bin/sh | |
mkdir ~/down/ | |
cd ~/down/ | |
sudo apt-get install build-essential | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz | |
tar -xzf Python-2.7.3.tgz | |
cd Python-2.7.3 | |
sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev | |
sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev | |
sudo apt-get install libssl-dev libdb-dev |
This file contains hidden or 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
# 1. Make sure you have nginx sub module compiled in | |
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module' | |
# 2. add two directives below at HTTP level | |
# nginx.conf | |
http { | |
# ...... | |
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */ |
This file contains hidden or 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
import time | |
import requests | |
import zlib | |
#!pip install lz4 pylzma zstd | |
import lz4.block | |
import pylzma as lzma | |
import zstd | |
def measure_time_and_compress_decompress(compress_func, decompress_func, data, *args): | |
# Measure compression time |
This file contains hidden or 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
#coding: utf-8 | |
def get_max_repeat(*arr): | |
length = len(arr) | |
if length == 0: | |
return 0, 0 | |
last_index = -1 | |
current_index = 0 | |
max_repeat_number = arr[0] |
This file contains hidden or 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
#coding:utf-8 | |
import os | |
import dropbox | |
app_key = 'app_key' | |
app_secret = 'app_secret' | |
def load_access_token(): | |
if os.path.isfile("access_token"): |
This file contains hidden or 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
test case 1: | |
case on the top | |
case in do while | |
case in 2 loop for | |
case in 2 loop for | |
case in default | |
test case 2: | |
case in do while | |
case in 2 loop for | |
case in 2 loop for |
This file contains hidden or 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
import numpy | |
import pylab | |
from scipy import stats | |
xi = numpy.arange(0, 9) | |
A = numpy.array([xi, numpy.ones(9)]) | |
# linearly generated sequence | |
y = [19, 20, 20.5, 21.5, 22, 23, 23, 25.5, 24] | |
slope, intercept, r_value, p_value, std_err = stats.linregress(xi, y) |
This file contains hidden or 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
#!/bin/sh | |
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh | |
set -e | |
# Must be a valid filename | |
NAME=shadowspdy_client | |
PIDFILE=/var/run/$NAME.pid | |
#This is the command to be run, give the full pathname | |
DAEMON=/opt/ShadowSPDY/bin/splocal |
This file contains hidden or 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 bash | |
# To use this script, you need to install gfwlist2pac, curl first | |
# install command: pip install gfwlist2pac | |
# For more information: https://github.com/clowwindy/gfwlist2pac | |
rm gfwlist.txt | |
rm gfwlist.js | |
curl --socks5-hostname 127.0.0.1:1080 http://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt > gfwlist.txt | |
gfwlist2pac -i gfwlist.txt -f gfwlist.js -p "SOCKS local.shadowsocks.com:1080; SOCKS5 local.shadowsocks.com:1080; DIRECT;" --user-rule user_rules.txt |
OlderNewer