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
{ | |
"meta": { | |
"theme": "kendall" | |
}, | |
"basics": { | |
"name": "Chen Du (杜琛)", | |
"label": "Cloud Ops Engineer", | |
"image": "https://gravatar.com/userimage/252197455/05d270125e2ee728cc21842d872b8274.jpeg?size=512", | |
"email": "[email protected]", | |
"phone": "18963609586", |
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 pandas as pd | |
import pickle | |
import numpy as np | |
from tabulate import tabulate | |
left_align_gen = lambda length, value: eval(r"'{:<<<length>>}'.format('''<<value>>'''[0:<<length>>])".replace('<<length>>', str(length)).replace('<<value>>', str(value))) | |
right_align_gen = lambda length, value: eval(r"'{:><<length>>}'.format('''<<value>>'''[0:<<length>>])".replace('<<length>>', str(length)).replace('<<value>>', str(value))) | |
# df = pd.read_pickle("dummy.pkl") |
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
def chunks(l, n): | |
n = max(1, n) | |
result = [l[i:i+n] for i in range(0, len(l), n)] | |
if len(result) * n > len(l): | |
last = result.pop(-1) | |
result[-1] += last | |
return result | |
lenf = 205 | |
div = 4 |
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
from datetime import datetime | |
with open('test.txt') as f: | |
date_list = f.read().split('\n') | |
date_list = [ x.replace('"', '').strip() for x in date_list if x] | |
for x in date_list: | |
try: | |
datetime.strptime(x, '%m/%d/%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
from tqdm import tqdm | |
import pandas as pd | |
from sqlalchemy import create_engine, MetaData | |
SOURCE_TABLE_NAME_LIST = ['individual_tagging_sd', ] | |
def chunker(seq, size): | |
return (seq[pos:pos + size] for pos in range(0, len(seq), size)) |
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/bash | |
if [ $# -lt 1 ]; then | |
echo -e "Shrink the size of raspberry pi image.\nUsage: bash $0 xxx.img " | |
ls -l *.img | |
exit | |
fi | |
IMG=$1 |
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 os | |
def split(filehandler, delimiter=',', row_limit=1000, | |
output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
import csv | |
reader = csv.reader(filehandler, delimiter=delimiter) | |
current_piece = 1 | |
current_out_path = os.path.join( | |
output_path, |
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 json | |
import sqlparse | |
import xmltodict | |
from pprint import pprint | |
def xml2dict(xmlString): | |
'''Return json object''' | |
jsonString = json.dumps(xmltodict.parse(xmlString), indent=4) | |
xml_in_dict = json.loads(jsonString) |
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 pyautogui | |
print('ready') | |
time.sleep(3) | |
print('start') | |
for i in range(30): | |
pyautogui.click(1689,444) | |
time.sleep(.5) |
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
sudo pip install git+git://github.com/powerline/powerline | |
wget https://github.com/powerline/powerline/blob/develop/font/PowerlineSymbols.otf?raw=true -O PowerlineSymbols.otf | |
sudo mv PowerlineSymbols.otf /usr/share/fonts/ | |
fc-cache -vf /usr/share/fonts/ | |
wget https://raw.githubusercontent.com/powerline/powerline/develop/font/10-powerline-symbols.conf | |
sudo mv 10-powerline-symbols.conf /etc/fonts/conf.d/ | |
echo "set rtp+=/usr/lib/python2.7/site-packages/powerline/bindings/vim/" >> ~/.vimrc | |
echo "set laststatus=2" >> ~/.vimrc | |
echo "set t_Co=256" >> ~/.vimrc |
NewerOlder