Skip to content

Instantly share code, notes, and snippets.

View bmmalone's full-sized avatar

Brandon Malone bmmalone

  • Tuebingen, Germany
View GitHub Profile
@bmmalone
bmmalone / jupyter-notebook-header.py
Last active October 10, 2017 09:01
Standard jupyter notebook header
%load_ext autoreload
%autoreload 2
%matplotlib inline
from argparse import Namespace
import misc.logging_utils as logging_utils
args = Namespace()
logger = logging_utils.get_ipython_logger()
@bmmalone
bmmalone / .bashrc
Last active January 19, 2023 06:20
Install OpenBLAS and add it to the path
### Lines to add to .bashrc
# for the OpenBLAS library
export LD_LIBRARY_PATH=/path/to/OpenBLAS:$LD_LIBRARY_PATH
export BLAS=/path/to/libopenblas.a
export ATLAS=/path/to/libopenblas.a
@bmmalone
bmmalone / Makefile
Created March 9, 2017 09:06
Makefile to use pandoc to convert all markdown files to html and pdf
# Makefile
#
# Converts Markdown to other formats (HTML, PDF) using Pandoc
# <http://johnmacfarlane.net/pandoc/>
#
# Run "make" (or "make all") to convert to all other formats
#
# Run "make clean" to delete converted files
#
# Adapted from: https://gist.github.com/kristopherjohnson/7466917
@bmmalone
bmmalone / Makefile
Created March 30, 2017 17:44
Makefile for latex
###
# Thanks to Niklas Jahnsson for putting this together.
#
# Replace: %s:bmc_article:<filename>:g
###
bmc_article.pdf: bmc_article.tex
pdflatex bmc_article
toc:
@bmmalone
bmmalone / dus
Created April 30, 2017 16:12
Show the size of contents of the current directory, sorted by size
#! /usr/bin/env bash
du -hs * | sort -h
@bmmalone
bmmalone / eps2bb
Created April 30, 2017 16:13
Use epstool to add a tight bounding box around the given eps figure
#! /usr/bin/env bash
epstool --copy --bbox $1.eps $1.bb.eps
rm $1.eps
mv $1.bb.eps $1.eps
@bmmalone
bmmalone / eps2png
Created April 30, 2017 16:14
Add a bounding box to the eps figure using epstool and convert it to png
#! /usr/bin/env bash
epstool --copy --bbox $1.eps $1.bb.eps
rm $1.eps
mv $1.bb.eps $1.eps
convert $1.eps $1.png
@bmmalone
bmmalone / fig2eps
Last active April 30, 2017 21:25
Convert an exported Xfig figure to an eps figure
#! /usr/bin/env python3
import argparse
import os.path
import shutil
import subprocess
user_home = os.path.expanduser('~')
default_template_file = os.path.join(
user_home,
@bmmalone
bmmalone / psgrep
Created April 30, 2017 17:09
Find processes from the current user which match the given regex
#! /usr/bin/env bash
ps aux | grep -E $USER.*$1 | grep -v 'grep\|-bash\|sshd:\|ps aux\|less' | less
@bmmalone
bmmalone / .vimrc
Last active May 10, 2017 00:07
Example vim config file
syntax on
set autoindent
set number
" try to handle tabs in makefiles correctly
filetype plugin on
" change to the directory of the current file by default
" workaround. see: https://github.com/vim/vim/issues/704
autocmd VimEnter * set autochdir