This file contains 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
# generate pub key | |
ssh-keygen -t rsa | |
# create folder for key | |
ssh user@host mkdir -p .ssh | |
# append pub key | |
cat .ssh/id_rsa.pub | ssh user@host 'cat >> .ssh/authorized_keys' |
This file contains 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
export FILEPATH=$(cd `dirname $0`; pwd) |
This file contains 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
var=/path/to/file.tar.gz | |
${var##*/} # file.tar.gz | |
${var##*.} # gz | |
${var#*.} # tar.gz | |
${var%/*} # /path/to | |
${var%%.*} #path/to/file.tar |
This file contains 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
var=/path/to/file.postfix | |
$(basename $var) # file.postfix | |
$(basename $var .postfix) # file | |
$(dirname $var) /path/to |
This file contains 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
export FILEPATH=$(cd `dirname $0`; pwd) |
This file contains 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
a = 0b101 # a = 5 | |
a = 0xf # a = 15 | |
a = 010 # a = 9 | |
# to dec | |
int('0xf', 16) # 15 | |
int('1011', 2) # 11 | |
int('17', 8) # 15 | |
# to hex |
This file contains 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 matplotlib | |
# if your environment has no desktop. | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
# A scatter map. | |
plt.figure(figsize=(width,height)) | |
plt.scatter(x,y) | |
plt.show | |
plt.savefig('scatter.png') |
This file contains 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 python | |
################################################################################# | |
# File Name : test-one.py | |
# Created By : Hao Li | |
# Creation Date : [2016-04-08 13:44] | |
# Last Modified : [2016-04-26 22:24] | |
# Description : | |
################################################################################# | |
import os |
This file contains 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 python | |
################################################################################# | |
# File Name : test-one.py | |
# Created By : Hao Li | |
# Creation Date : [2016-04-08 13:44] | |
# Last Modified : [2016-04-26 13:49] | |
# Description : | |
################################################################################# | |
import os |
This file contains 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 python | |
################################################################################# | |
# File Name : PlateModel.py | |
# Created By : Hao Li | |
# Creation Date : [2016-04-19 16:27] | |
# Last Modified : [2016-04-23 15:17] | |
# Description : | |
################################################################################# | |
from pymongo import MongoClient | |
import os |
OlderNewer