Skip to content

Instantly share code, notes, and snippets.

View matthewcarbone's full-sized avatar
🏠
Working from home

Matthew Carbone matthewcarbone

🏠
Working from home
View GitHub Profile
@matthewcarbone
matthewcarbone / mpl_utils.py
Created July 11, 2022 18:35
Helper for making nice plots in matplotlib
import matplotlib as mpl
import matplotlib.pyplot as plt
from mpl_toolkits import axes_grid1
class MPLAdjutant:
def __init__(self):
self.default_DPI = 250
# self.default_labelsize = 14
@matthewcarbone
matthewcarbone / README.md
Created June 28, 2018 15:14
Basic usage of GPU code on a cluster

Step 1: Generate a virtual environment using Anaconda. conda create -n tensorflow pip python=3.3

Step 2: Within that virtual environment on the login node, install the tensorflow-gpu package. My VI is called 'tensorflow'. conda install -n tensorflow anaconda tensorflow-gpu

Step 3: Make tf_gpu_test.py executable. chmod +x tf_gpu_test.py

@matthewcarbone
matthewcarbone / parse_yaml.sh
Created May 29, 2018 14:26 — forked from pkuczynski/parse_yaml.sh
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}