Skip to content

Instantly share code, notes, and snippets.

View bmmalone's full-sized avatar

Brandon Malone bmmalone

View GitHub Profile
@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 / 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 / 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 / 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@bmmalone
bmmalone / conda_wrapper.sh
Last active November 28, 2024 13:12
Automation on top of conda
#! /usr/bin/env bash
PYTHON_VERSION="3.12.7"
function mkipycondaenv {
if [ "$#" -ne 1 ]; then
echo "usage: mkipycondaenv <condaenv_name>"
return 1
fi
@bmmalone
bmmalone / cross-validation.pseudo
Created April 15, 2021 08:41
Pseudocode for cross-validation with embedding models
given labeled_training_indices (e.g., maybe there are 20 labeled training instances)
given labeled_test_indices (there are always ~3000 of these due to the split created by Harutyunyan et al.)
train_fold, val_fold <- stratified split(labeled_training_indices, train=70%, "test"=30%) # "test" is really the validation set here
# for example, if we have 20 labeled training instances, then we have 14 instances for training and 6 for validation
# ... so we really don't have a lot when the number of labeled training instances is small
hp_grid = ParameterGrid({
'penalty': ['l1', 'l2'],
def add_home_dir(*fn):
import os.path
return os.path.join(os.path.expanduser('~'), *fn)
c.ServerApp.ip = '*'
c.ServerApp.port = 9999
c.ServerApp.certfile = add_home_dir('certs', 'mycert.pem')
c.ServerApp.keyfile = add_home_dir('certs', 'mykey.key')
@bmmalone
bmmalone / install-docker-debian.sh
Last active March 16, 2022 09:59
Install docker on Debian. Further, create the docker group and add the current user to it. Finally, set a custom location for storing images.
#! /usr/bin/env bash
image_loc="/data/docker"
###
# https://docs.docker.com/engine/install/debian/
###
# set up the docker repository