Skip to content

Instantly share code, notes, and snippets.

@corolla96
corolla96 / python_basics01.py
Created April 16, 2019 02:30
Python basics 01
print 'Hello World!'
@corolla96
corolla96 / house1.py
Created May 17, 2019 06:24
House data analysis
import csv
import numpy
def _read_csv(file_name):
house_list = []
with open(file_name, 'r') as f:
reader = csv.DictReader(f)
for house in reader:
house_list.append((house['price'], house['bd'], house['sqft'], house['date'].split('/')[-1]))
import csv
import gps
from uber_rides.session import Session
from uber_rides.client import UberRidesClient
token = '<redacted>'
session = Session(server_token=token)
client = UberRidesClient(session)
@corolla96
corolla96 / settings.json
Created June 14, 2019 23:20
vscode pep8 settings. ignore line too long
"python.linting.pep8Args": ["--ignore=E501"]
@corolla96
corolla96 / config.json
Created November 26, 2019 04:15
shadowsocks-r
{
"server_port":9800,
"password":"",
"protocol":"origin",
"obfs":"tls1.2_ticket_auth_compatible",
"method":"aes-128-cfb",
"server":"0.0.0.0",
"server_ipv6":"::",
"local_address":"127.0.0.1",
"local_port":1080,
@corolla96
corolla96 / config.json
Created November 26, 2019 04:17
shadowsocks
{
"server":"0.0.0.0",
"server_ipv6":"::",
"port_password": {
"443": "",
"9801": "",
"9802": "",
"9803": "",
"9804": "",
"9805": "",
@corolla96
corolla96 / example.py
Created December 2, 2019 12:35
find common emails from two lists (intersection from two sets)
import csv
def intersection(list1, list2):
"""
Find the unique intersection of two lists and return the intersection as a list.
"""
return [value for value in list1 if value in list2]
folder_count=$(($(ls | wc -l) / 1000 + 1))
for (( i=1; i<=$folder_count; i++ ))
do
d=dir_$(printf %03d $i);
mkdir -p $d;
done
j=0;
for f in $(find . -maxdepth 1 -type f);
do
func PrettyString(str string) (string, error) {
var prettyJSON bytes.Buffer
if err := json.Indent(&prettyJSON, []byte(str), "", " "); err != nil {
return "", err
}
return prettyJSON.String(), nil
}