Skip to content

Instantly share code, notes, and snippets.

View kangwonlee's full-sized avatar
🏠
Working from home

Kangwon Lee (Education) kangwonlee

🏠
Working from home
View GitHub Profile
@kangwonlee
kangwonlee / get_parser_cv_conf_paper.py
Last active March 6, 2017 01:08
CV (Curriculum Vitae) conference paper entry parser in regular expression
"""
This is an attempt to automate extracting some fields from an entry of Curriculum Vitae on a conference publication.
For more about regular expression, please refer to https://docs.python.org/library/re.html.
"""
import re
def get_parser_cv_conf_paper():
return re.compile(
r'(?P<paper_number>\(\d+\))[.,]?\s*(?P<authors>.+?)\s*[,:;]?\s*["“](?P<paper_title>.+?)["“”],?\s*(?P<conference_info>.+)')
@kangwonlee
kangwonlee / unpack_ipynb.py
Created March 8, 2017 07:21
Unpack iPython notebook
'''unpack ipynb'''
import os
from pprint import pprint
import re
import sys
def dont_do_anything(fw, cell_dict):
print "won't do anything about", cell_dict["cell_type"]
print cell_dict
@kangwonlee
kangwonlee / ipynb_remove_output.py
Created August 13, 2017 14:57
remove ipython outputs and execution numbers
"""
Jupyter notebook could be good for educational purpose.
Before release in class, output generated during testing and execution number need to be removed.
"""
import os
import sys
import nbformat
@kangwonlee
kangwonlee / unittest_commit_range.py
Created December 2, 2017 15:13
Run unittest over a range of commits
import subprocess
import sys
def generate_commit(data_txt):
for line in data_txt.splitlines():
yield line.split()[0]
def main(git_path, start_commit, end_commit, python_path, unittest_file_path):
"""
To augment lines of a text file with an 'OR' logical operator
How to use:
1. Prepare a .txt file with line items to combine with 'OR'
2. Use the file name as argument for the script
3. This script would generate a text
"""