Skip to content

Instantly share code, notes, and snippets.

View osteele's full-sized avatar

Oliver Steele osteele

View GitHub Profile
@osteele
osteele / vote-counter.py
Last active September 26, 2017 16:28
Count the votes in a Liquid Democracy Google Sheet
import pandas as pd
spreadsheet_key = '' # from the Google sheets Publish URL
spreadsheet_range = '' # e.g. B6:E15
url = 'https://docs.google.com/spreadsheets/d/e/{}/pub?gid=0&single=true&output=csv'.format(spreadsheet_key)
if spreadsheet_range:
url += '&range=' + spreadsheet_range
# TODO read this from the doc
@osteele
osteele / find-malicious-conda-env-packages
Created September 15, 2017 14:30
Report malicious PyPI packages in conda environments
#!/bin/bash
# Report malicious PyPI packages in each conda environment.
# See discussion at https://news.ycombinator.com/item?id=15256121
packages=$(cat <<EOF
acqusition
apidev-coop
bzip
crypt
# SpaceTranslationPatch patches the MacOS Python IDE to convert spaces to tabs
# when a source file is opened, and back to spaces when it's saved.
#
# Drop this file on PythonIDE to install it. It requires
# http://www.strout.net/python/mac/PatchUtils.py in order to run.
#
# Version 2 released to the public domain 3 November 1999
# by Oliver Steele (steele@cs.brandeis.edu).
@osteele
osteele / build_numpy.sh
Created May 30, 2017 13:45
Build numpy on macOS
brew install gcc
pip install nose numpy Tempita
python runtests.py -v
@osteele
osteele / docker-machine-rename
Last active April 19, 2017 18:59 — forked from alexproca/docker-machine-rename
Rename docker-machine
#!/usr/bin/env bash -eu
#copy this in a folder from path ex: /usr/local/bin
#usage: docker-machine-rename default my-default
# From https://gist.github.com/alexproca/2324c60c86380b59001f
# w/ comments from eurythmia
OLD_MACHINE_NAME=${1:-default};
NEW_MACHINE_NAME=${2:-my-default-2};
@osteele
osteele / docker-functions.sh
Created April 10, 2017 01:50
Bash functions for working on an npm package from within Docker
d.exec () {
docker run \
-v yarn_cache:/root/.cache/yarn \
-v `pwd`:/app \
-v signage_node_modules:/app/node_modules \
-p 3000:3000 \
-it \
node \
"$@"
}
@osteele
osteele / Email Scores to Students.ipynb
Created February 24, 2017 02:33
Email scores to students in a spreadsheet.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@osteele
osteele / nagbot.py
Last active March 11, 2016 23:04
Synthesize reminder messages for students who haven't submitted pull requests for the required number of toolbox projects.
# -*- coding: utf-8 -*-
"""Print email nags regarding toolbox pull requests.
The current directory should contain a file `Master Grades.xlsx` with two sheets, and columns
`First Name`, `Last Name`, `E-mail`, and `GitHub`.
Author: Oliver Steele <oliver.steele@olin.edu>
"""
import os
@osteele
osteele / install-jupyter-launchagent.sh
Created January 22, 2016 15:04
install-jupyter-launchagent.sh
#!/bin/bash -eu
die() { echo "$@" 1>&2 ; exit 1; }
LAUNCH_AGENTS_DIR=~/Library/LaunchAgents
[[ -d $LAUNCH_AGENTS_DIR ]] || die "Missing directory: $LAUNCH_AGENTS_DIR. Are you sure you're on a Mac?"
NOTEBOOK_DIR=~/code/notebooks
[[ -d $NOTEBOOK_DIR ]] || die "Missing directory: $NOTEBOOK_DIR"
@osteele
osteele / install-sublime.sh
Last active January 21, 2016 15:36
Install Sublime Text 3 and recommended packages for SoftDes2015.
#!/bin/bash -eu
# Usage: wget https://gist.githubusercontent.com/osteele/7f53dce67ce2925f55e2/raw/install-sublime.sh | bash
# Add the Sublime Text 3 (ST3) repository
sudo add-apt-repository ppa:webupd8team/sublime-text-3
# Update and upgrade your system:
sudo apt-get update
sudo apt-get upgrade