git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
#!/bin/bash | |
MONGO_DATABASE="annotation" | |
MONGO_HOST="10.0.5.40" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%Y-%m-%d-%H-%M-%S` | |
MONGODUMP_PATH=/usr/bin/mongodump | |
BACKUPS_DIR=~/sjyan/data/mongodb-backup/ | |
BACKUP_NAME=$TIMESTAMP | |
SCRIPT_DIR=~/sjyan/scripts/ |
#!/bin/bash | |
for f in /Users/yanshengjia/GitHub/*; | |
do | |
[ -d $f ] && cd "$f" && echo Entering into $f and git pull | |
git pull | |
done; |
def concat_files(): | |
filenames = ['file1.txt', 'file2.txt'] | |
with open('path/to/output/file', 'w') as outfile: | |
for fname in filenames: | |
with open(fname) as infile: | |
for line in infile: | |
outfile.write(line) | |
def concat_binary_files(): | |
with open('output_file.txt','wb') as wfd: |
# !/usr/bin/python | |
# -*- coding:utf-8 -*- | |
# @author: Shengjia Yan | |
# @date: 2017-11-29 Wednesday | |
# @email: i@yanshengjia.com | |
import json | |
import codecs | |
class ARPAParser: |
#!/bin/bash | |
MONGO_DATABASE="annotation" | |
MONGO_HOST="127.0.0.1" | |
MONGO_PORT="27017" | |
TIMESTAMP=`date +%Y-%m-%d-%H-%M-%S` | |
MONGODUMP_PATH=/usr/bin/mongodump | |
BACKUPS_DIR=~/sjyan/data/mongodb-backup/ | |
BACKUP_NAME=$TIMESTAMP | |
SCRIPT_DIR=~/sjyan/scripts/ |
#include <iostream> | |
using namespace std; | |
int main() { | |
int a[] = {1, 2, 3, 4, 5}; | |
int res = *((int *)(&a + 1) - 1); | |
cout << res << endl; | |
return 0; | |
} |
# python2 | |
def check_line_numbers(): | |
file_path = 'test.txt' | |
num_lines = sum(1 for line in open(file_path)) | |
print(num_lines) |
import re | |
from nltk.corpus import stopwords | |
from nltk.stem.wordnet import WordNetLemmatizer | |
def clean(raw_str): | |
en_stopwords = set(stopwords.words('english')) | |
lemma = WordNetLemmatizer() | |
lower_str = raw_str.lower() | |
punc_free_str = ' '.join(re.findall(r'\w+', lower_str)) | |
stop_free_str = ' '.join([i for i in punc_free_str.split() if i not in en_stopwords]) |