Instantly share code, notes, and snippets.

View calc
#!/bin/bash
# Turn scientic notation of rational number
in="$(echo ${*} | sed -e 's/\([0-9.]\)[eE]\([0-9+-]\)/\1*10^\2/g' -e 's/--/+/g' )"
# calculate and turn back to scientific notation
printf "%.7f\n" $(echo "scale=63; ${in}" | bc ;exit)
View tf
#!/bin/bash -eu
# Translate a LaTeX formula on-the-fly
echo ${1}
template=$(mktemp)
echo ${template}
View pwhich
#!/usr/bin/env python
### Print the main __init__.py file location of a python module
def pwhich():
import optparse
parser = optparse.OptionParser(usage="""%prog <module-name>""")
options, args = parser.parse_args()
View pwhichd
#!/usr/bin/env python
### Print the installed location of a python module
def pwhichd():
import optparse
import os
parser = optparse.OptionParser(usage="""%prog <module-name>""")
options, args = parser.parse_args()
View ppath
#!/usr/bin/env python
### List current import path for python
def ppath():
import sys
for p in sys.path:
print(p)
if __name__ == '__main__':
View memory_footprints.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View NYC Taxi Clustering.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View search_and_catkit.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View search_and_catkit.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View search_and_catkit.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.