Skip to content

Instantly share code, notes, and snippets.

View bmmalone's full-sized avatar

Brandon Malone bmmalone

View GitHub Profile
@bmmalone
bmmalone / svg2pdf
Created October 22, 2018 13:59
Convert an inkscape svg file to pdf for use in a latex document
#! /usr/bin/env bash
inkscape -D -z --file=$1.svg --export-pdf=$1.pdf --export-latex
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmmalone
bmmalone / mac2unix
Created July 31, 2018 10:04
Convert carriage returns to line feeds
#! /usr/bin/env bash
tr '\r' '\n' < $1 > $1.tmp
mv $1.tmp $1
@bmmalone
bmmalone / venv_wrapper.sh
Last active September 11, 2018 08:05
A wrapper for creating virtual environments with venv
#! /usr/bin/env bash
# check that WORKON_HOME has been set
function _venv_verifty_workon_home {
if [ ! -v WORKON_HOME ]; then
printf "$1: please set WORKON_HOME, "
printf ".bashrc example: \"export WORKON_HOME=<path>\"\n"
printf "quitting.\n"
return 1
@bmmalone
bmmalone / install-ep.complete.sh
Last active March 22, 2018 14:28
Embedding propagation installation instructions
#! /usr/bin/env bash
export PATH=$HOME/local/bin:$PATH
export PYTHON_2_VERSION=2.7.13
export PYTHON_3_VERSION=3.6.1
# executables will be installed in $HOME/local/bin
mkdir -p $HOME/local/bin
cd $HOME/local/bin
@bmmalone
bmmalone / install-pagoda-prerequisites.sh
Last active September 11, 2018 07:28
Install Pagoda prerequisties
#! /usr/bin/env bash
# pixman
wget https://cairographics.org/releases/pixman-0.34.0.tar.gz
tar -xvf pixman-0.34.0.tar.gz
cd pixman-0.34.0/
./configure --prefix=$HOME/local --disable-static
make
make install
export pixman_CFLAGS="-I$HOME/local/include/pixman-1"
@bmmalone
bmmalone / pickle-stan
Created March 12, 2018 09:18
Pickle a stan model file (python3)
#! /usr/bin/env python3
import argparse
import pickle
from pystan import StanModel
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="This script compiles a stan model and pickles it to disc")
parser.add_argument("stan", help="The stan model file")
@bmmalone
bmmalone / build-gcc
Last active December 19, 2023 23:29 — forked from jeetsukumaran/build-gcc.sh
Build and Install GCC Suite from Scratch
#! /bin/bash
GCC_VERSION="10.1.0"
WORKDIR="$HOME/gcc/src/"
INSTALLDIR="/$HOME/gcc/install/gcc-${GCC_VERSION}"
set +h
unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE LD_LIBRARY_PATH
@bmmalone
bmmalone / hostnames2ips
Created December 2, 2017 21:18
Convert a list of hostnames to IP addresses
#! /usr/bin/env bash
while read p; do
getent hosts $p | cut -d' ' -f 1
done <$1
@bmmalone
bmmalone / convert-all-eps2png
Created November 24, 2017 17:09
Convert all of the eps files in the current directory to png
#! /usr/bin/env bash
find . -name "*eps" -exec sh -c 'eps2png "${0%.*}"' {} \;