Skip to content

Instantly share code, notes, and snippets.

View mhoffman's full-sized avatar

Max Hoffmann mhoffman

View GitHub Profile
#!/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)
#!/bin/bash -eu
# Translate a LaTeX formula on-the-fly
echo ${1}
template=$(mktemp)
echo ${template}
#!/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()
#!/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()
#!/usr/bin/env python
### List current import path for python
def ppath():
import sys
for p in sys.path:
print(p)
if __name__ == '__main__':
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.