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
""" | |
Author: Eric J. Ma | |
Affiliation: Massachusetts Institute of Technology. | |
Purpose of Code: | |
This code was written because I did not find a sufficiently-concise way of identifying whether | |
two nodes were connected by some path. Bidirectional Djikstra as implemented in NetworkX returns | |
False is not connected, but (length, path) if connected; I wanted a pure "True/False" | |
implementation. |
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
""" | |
In response to Stack Overflow question: http://stackoverflow.com/questions/24830029/python-less-greater-than-issue#24830029 | |
""" | |
def batpower(power): | |
if power >= 70: | |
return "good" | |
elif power <= 70 and power > 30: | |
return "ok" | |
elif power <= 30: |
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 os | |
from PyPDF2 import PdfFileReader, PdfFileMerger | |
files_dir = os.getcwd() | |
if 'stripped' not in os.listdir(files_dir): | |
os.mkdir('stripped') | |
for f in os.listdir(files_dir): |
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
""" | |
Author: Eric J. Ma | |
Purpose: To merge PDFs together in an automated fashion. | |
""" | |
import os | |
from PyPDF2 import PdfFileReader, PdfFileMerger |
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
language: python | |
python: | |
# We don't actually use the Travis Python, but this keeps it organized. | |
- "2.7" | |
- "3.4" | |
sudo: false | |
install: | |
# We do this conditionally because it saves us some downloading if the |
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
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
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
name: envname | |
dependencies: | |
- python=3 | |
- package1 | |
- package2 | |
- pip | |
- pip: | |
- pypi_package1 | |
- pypi_package2 |
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
# distutils: extra_compile_args = -O2 -w | |
# cython: boundscheck=False, nonecheck = False, wraparound=False, cdivision=True | |
import numpy as np | |
cimport numpy as np | |
import operator as op | |
from cython.parallel import prange | |
from cython import boundscheck, nonecheck, wraparound |
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 os | |
import click | |
packages = ['circos', 'hiveplot', 'pandoc-attributes', | |
'pandoc-fignos', 'pandoc-xnos', 'pandocfilters', | |
'twine', 'lektor'] | |
# for f in os.listdir(os.getcwd()): | |
# if ".sh" in f: | |
# os.system("bash {0}".format(f)) |
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
conda list | tr -s ' ' | cut -d ' ' -f1 | uniq -c | awk '$1>1' |
OlderNewer