Skip to content

Instantly share code, notes, and snippets.

@erelson
erelson / gist:35a23ac28aa800af9a06ba7822afdaa7
Created August 13, 2021 05:04
Set an email when cloning repos
# Use this with a git alias like `cl = "!sh ~/clone_helper.sh"`
# A bash function to replace `git clone` could also be done
# like in https://stackoverflow.com/a/39357426/999505
set -e
if [ $# = 0 ]; then # forgot to pass anything, d'oh
echo ERROR Must pass repo path to clone
exit 1
fi
@erelson
erelson / gist:56a0f3bbab8c8a903743be1b94aefd8c
Created December 19, 2020 19:06
PoGo rocket balloon math
import random
count = 1000
print("For {0} leaders at each balloon chance...".format(count))
for jj_frac in [0.15, 0.2, 0.25, 0.3, 0.4, 0.45, 0.5]:
tally = 0 # radar pieces accumulated
balloons = 0 # of balloon visits
for n in range(count):
pieces = 0
leader = False
@erelson
erelson / systemd_from_upstart.md
Last active April 17, 2019 21:55
Upstart to Systemd for Fetch research robot

This document outlines what changes were made to switch from upstart to near-equivalent behavior with systemd for Fetch research robots. Useful links are at the end!


First we look at the fairly simple robot drivers upstart file's conversion from robot.conf to robot.service. The original (distributed with the fetch-system-config debian):

@erelson
erelson / .bash_prompt
Created February 14, 2013 17:25
Colors for bash prompt. To use this add `source ~/.bash_prompt` to .bashrc. Adapted from Sexy Bash Prompt.
# Sexy Bash Prompt, inspired by "Extravagant Zsh Prompt"
# Screenshot: http://i.imgur.com/uAQSa.png
# A big thanks to \amethyst on Freenode
# Modified by erelson for colors/compactness, 2/2013.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/
null 2>&1; then TERM=gnome-256color; fi
#if [[ $(tput colors) -ge 256 ]] 2>/dev/null; then
# MAGENTA=$(tput setaf 5)
# ORANGE=$(tput setaf 172)