Skip to content

Instantly share code, notes, and snippets.

View Sigafoos's full-sized avatar

Dan Conley Sigafoos

View GitHub Profile
@Sigafoos
Sigafoos / jpost.py
Last active September 21, 2017 18:14
Python script to create the file and YAML frontmatter for a Jekyll post
#!/usr/bin/python
from slugify import slugify # this will have to be installed via pip
import subprocess
import time
blog_dir = "/home/you" # CHANGE THIS
blog_name = "blog" # CHANGE THIS
posts_dir = "/_posts"
@Sigafoos
Sigafoos / pinewood_derby.py
Last active January 14, 2018 04:33
WIP derby code. Uses a Circuit Playground Express and OLED Featherwing
import time
import adafruit_lis3dh
import adafruit_ssd1306
import board
import busio as io
from digitalio import DigitalInOut, Direction, Pull
import neopixel
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=.2)
BLUE = (0, 0, 0x10)
import requests
import sys
with open(sys.argv[1]) as fp:
for l in fp.read().split("\n"):
parts = l.split("@")
if len(parts) != 2: continue
url = "https://{}/@{}.json".format(parts[1], parts[0])
try:
r = requests.get(url)
@Sigafoos
Sigafoos / cat.cow
Created November 2, 2018 16:24
For use in cowsay
##
## A cat!
##
## from https://user.xmission.com/~emailbox/ascii_cats.htm
##
$the_cow = <<EOC;
$thoughts
$thoughts
/\\_/\\
>^.^<.---.
[{"type": "flying", "name": "Aerial Ace", "gym": {"duration": 2.4, "damage": 55, "critical_percentage": 0}, "pokemon": ["Beedrill", "Pidgey", "Pidgeotto", "Pidgeot", "Spearow", "Fearow", "Farfetch'd", "Doduo", "Dodrio", "Scyther", "Hoothoot", "Ledyba", "Ledian", "Togetic", "Xatu", "Aipom", "Yanma", "Gligar", "Delibird", "Mantine", "Treecko", "Grovyle", "Sceptile", "Taillow", "Swellow", "Nincada", "Ninjask", "Shedinja", "Swablu", "Tropius", "Rayquaza", "Starly", "Staravia", "Kricketune", "Mothim", "Ambipom", "Glameow", "Purugly", "Mantyke", "Togekiss", "Yanmega", "Gliscor"], "pvp": {"damage": 55, "energy": 45}}, {"type": "flying", "name": "Air Cutter", "gym": {"duration": 2.7, "damage": 60, "critical_percentage": 0}, "pokemon": ["Pidgey", "Pidgeotto", "Zubat", "Golbat", "Farfetch'd", "Crobat", "Beautifly", "Wingull", "Masquerain"], "pvp": {"damage": 60, "energy": 55}}, {"type": "rock", "name": "Ancient Power", "gym": {"duration": 3.5, "damage": 70, "critical_percentage": 0}, "pokemon": ["Exeggcute", "Omanyte",
@Sigafoos
Sigafoos / git-bump
Created June 10, 2019 00:02
bump the semver tag of a git repo (using go 1.12+ style v4.1.3 tags)
#!/bin/bash
bump=$1
if [ -z $bump ]; then
echo "need to provide an action"
exit 1
fi
tag=($(git describe --abbrev=0 --tags | perl -pe 's/^v?(\d+)\.(\d+)\.(\d+)$/\1 \2 \3/g'))
import json
import sys
floors = {
'good': 1,
'great': 2,
'ultra': 3,
'weather': 4,
'best': 5,
'hatch': 10,
@Sigafoos
Sigafoos / todo.js
Last active September 30, 2019 16:30
JavaScript to parse todo.txt (todotxt.org) formatted todos into objects
const date = '\\d{4}-\\d{2}-\\d{2}',
contextre = /\B@\w+/g;
projectre = /\B\+\w+/g,
tagre = /[\w\-_]+:[\w\-_]+/g;
const pluckAll = (raw, re) => {
let matches = raw.match(re);
if (matches) {
matches.forEach(p => {
let position = raw.indexOf(p);
@Sigafoos
Sigafoos / git-pr
Created January 3, 2024 14:15
git-pr
git push -u origin $(git rev-parse --abbrev-ref HEAD) && gh pr create
@Sigafoos
Sigafoos / git-purge
Created February 29, 2024 13:53
git-purge
#!/bin/bash
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D