Skip to content

Instantly share code, notes, and snippets.

View Sigafoos's full-sized avatar

Dan Conley Sigafoos

View GitHub Profile
### Keybase proof
I hereby claim:
* I am Sigafoos on github.
* I am dconley (https://keybase.io/dconley) on keybase.
* I have a public key whose fingerprint is C8E9 642A F731 3631 1294 6A0B 1EF8 32E1 2866 4DA0
To claim this, I am signing this object:
@Sigafoos
Sigafoos / AutoHotkey.ahk
Created May 12, 2015 13:54
AutoHotkey for conditional Capslock::Esc remapping
classname = ""
keystate = ""
+Capslock::Capslock
CapsLock::
WinGetClass, classname, A
if (classname = "PuTTY" or classname = "Vim")
{
send,{Esc down}
# Set colors
set-option -g default-terminal "screen-256color"
# Set reload key to r
bind r source-file ~/.tmux.conf
# Use vim bindings
setw -g mode-keys vi
# copy/paste
execute pathogen#infect()
set autoindent
set cindent
set smartindent
set number
set hlsearch
set so=2
set clipboard=unnamed
set cursorline
highlight CursorLine cterm=NONE ctermbg=darkgrey ctermfg=None
@Sigafoos
Sigafoos / gist:bb453eec3a7c9401600a
Last active August 29, 2015 14:24
Tampermonkey to pull selected Overcast podcasts to the top of the page
// ==UserScript==
// @name Overcast Politics
// @namespace http://danconley.net
// @version 0.1
// @description Sort podcasts by group
// @author Dan Conley
// @match https://overcast.fm/podcasts
// @grant none
// @require http://code.jquery.com/jquery-1.11.3.min.js
// ==/UserScript==
@Sigafoos
Sigafoos / highlow.py
Created February 19, 2017 20:22
Determine the success rates of algorithms for high/low
import random
from copy import deepcopy
# create the set of cards (2-10, JQKA) x4. suits don't matter.
deck = [x for x in xrange(2, 15)] * 4
# translate the numerical value to the string
def to_card(i):
if i == 11:
return 'J'
@Sigafoos
Sigafoos / nighttimeclock.ino
Created February 20, 2017 23:46
Use an Arduino Nano with two LEDs, red for "stay in bed" and green for "it's okay to get up". Set the time via serial before unplugging: make sure you have an alternate power source. I soldered a 9v connector to the VIN for that.
#include <Time.h>
#include <TimeLib.h>
#include <TimeAlarms.h>
int greenLED = 5;
int redLED = 7;
#define TIME_MSG_LEN 11 // time sync to PC is HEADER followed by Unix time_t as ten ASCII digits
#define TIME_HEADER 'T' // Header tag for serial time sync message
#define HMS_MSG_LEN 6 // time sync to PC is HEADER followed by HHMMSS as digits
@Sigafoos
Sigafoos / circuitplayground-Circuit-Jouster.js
Last active August 10, 2017 15:35
A game where you have to keep a Circuit Playground level for as long as possible. It keeps track of your "score" (2 points per second) and displays it at the end of the game.
// variables
let soundsOn = true // false if you don't want any sounds
let modifier = 100 // lower == harder
// the game flow
light.pixels.clear()
startUp()
let rounds = playGame(modifier)
serial.writeLine("rounds: " + rounds.toString())
endGame(soundsOn)
// Specifically for use with the Adafruit Feather, the pins are pre-set here!
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <SD.h>
#include <Adafruit_VS1053.h>
#include "config.h" // not included here, but the standard config.h file used with io.adafruit.com
AdafruitIO_Feed *knock = io.feed("knock");
AdafruitIO_Feed *hello = io.feed("hello");
@Sigafoos
Sigafoos / twitter_followers.py
Created September 18, 2017 17:31
In CircuitPython
import json
import urequests
import base64
with open("config.json") as fp:
config = json.load(fp)
if config['key'] is None:
raise KeyError("No twitter API key")
if config['secret'] is None: