Skip to content

Instantly share code, notes, and snippets.

@DarryO
DarryO / SSH Setting.sh
Last active Mar 6, 2016
Add file extension
View SSH Setting.sh
# 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'
@DarryO
DarryO / get-filepath.sh
Created Mar 9, 2016
get the path of current script.
View get-filepath.sh
export FILEPATH=$(cd `dirname $0`; pwd)
@DarryO
DarryO / str_cut.sh
Created Mar 14, 2016
cut str using shell ${}
View str_cut.sh
var=/path/to/file.tar.gz
${var##*/} # file.tar.gz
${var##*.} # gz
${var#*.} # tar.gz
${var%/*} # /path/to
${var%%.*} #path/to/file.tar
@DarryO
DarryO / filepath.sh
Created Mar 14, 2016
get file path or dir path using dirname and basename
View filepath.sh
var=/path/to/file.postfix
$(basename $var) # file.postfix
$(basename $var .postfix) # file
$(dirname $var) /path/to
@DarryO
DarryO / get-filepath.sh
Created Mar 14, 2016
get dir path in a script
View get-filepath.sh
export FILEPATH=$(cd `dirname $0`; pwd)
@DarryO
DarryO / hex-bin-dec-oct.py
Created Apr 6, 2016
hex, bin, oct, dec convert to each other
View hex-bin-dec-oct.py
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
@DarryO
DarryO / plot.py
Created May 13, 2016
Using matplotllib to plot
View plot.py
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')
@DarryO
DarryO / CaffeModel.py
Created May 13, 2016
Using Caffe model to predict
View CaffeModel.py
#! /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
@DarryO
DarryO / MxNetModel.py
Created May 13, 2016
Using Mxnet model to predict
View MxNetModel.py
#! /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
@DarryO
DarryO / PurineModel.py
Created May 13, 2016
Using Purine model to predict
View PurineModel.py
#! /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
You can’t perform that action at this time.