Skip to content

Instantly share code, notes, and snippets.


Brandon Stafford pingswept

View GitHub Profile
from fabric import task
# Usage
# fab -H pi@ --prompt-for-login-password deploy
def deploy(c):
hostname ='hostname', hide=True).stdout
print('\033[32;1mLogged into {0}\033[0m'.format(hostname))
pingswept /
Last active Mar 9, 2021
import cProfile
import pstats
from import *
import datetime
import random
latitudes = random.sample(range(-90, 90), 100)
longitudes = random.sample(range(-180, 180), 100)
pingswept /
Created Mar 4, 2021
Demo of how to memoize a function in Python
import functools
import timeit
import time
def fib(n):
if n < 2:
return n
return fib(n-1) + fib(n-2)
View whatever.ino
WiFi Web Server LED Blink
A simple web server that lets you blink an LED via the web.
This sketch will print the IP address of your WiFi module (once connected)
to the Serial monitor. From there, you can open that address in a web browser
View Whatever.html
pingswept / drivestrength.ino
Created Oct 26, 2020
Fixing the drive strength mode on the Arduino MKR Wifi 1010
View drivestrength.ino
void setup() {
pinMode(4, OUTPUT);
void loop() {
digitalWrite(4, HIGH);
bool setHighStrengthOutputPinMode( uint32_t ulPin)
pingswept /
Last active Jul 1, 2018
Python script to turn a fan on and off based on SHT31 temperature and temperature from the internet
from Adafruit_IO import *
import json
import requests
import RPi.GPIO as GPIO
import smbus
import time
GPIO.setmode(GPIO.BCM) # choose BCM or BOARD
pingswept /
Created Aug 8, 2017
Script for Chris to manipulate his G-code
infile = "infile.txt" # the file to open
copies = 3 # how many copies to make
marker = "STARTHERE\n"
with open(infile, 'r') as infile:
lines = infile.readlines()
startline = lines.index(marker)
result = ''.join(lines + (lines[startline + 1:] * copies))
View sneakers.csv
Brand Model Size Width Good/bad
New Balance Fresh Foam Gobi 14 EE Ill-fitting and stiff, but low arch is good. VL-6 last. Might be okay. Should try v2, will drop in July 2017.
New Balance Fresh Foam Hierro v2 14 4E Almost good but arch too high. Same PL-4 last as favorite MO69v1's. Disappointing.
New Balance Minimus 10v1 14 EE Almost good but arch too high. NL-1 last. Very comfy other than arch.
Montrail Fluid Flex FKT 14 -- WINNER! 8 pairs, 6 left. Update: not on Zappos any more. One color on, May 2017.
Brooks Puregrit 4 14 -- Trevor recommended but haven't tried yet because of previous Brooks being too short in 14.
Topo MT-2 14 -- Kept. Might be serviceable.
Montrail Fluid Flex ST 14 -- WINNER! 3 pairs. Update: no longer available.
Nike Air Zoom Wildhorse 3 14 -- kept. Insole is a little stiff but could be a winner.
Montrail Fluid Flex II 14 ? Good. 1 pair. Blisters on long runs. Update: no longer available.
pingswept /
Last active Sep 3, 2015
Winterizing the house


  • Cut power to well pump
  • Cut power to hot water heater with circuit breaker
  • Close main water valve
  • Open all faucets, and leave them open
    • kitchen sink, including blowing out spray hose
    • bathroom #1, including shower
    • bathroom #2, including shower
  • Drain water heater through garden hose