Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Conley Sigafoos

View GitHub Profile
@Sigafoos
Sigafoos / todo.js
Last active Sep 30, 2019
JavaScript to parse todo.txt (todotxt.org) formatted todos into objects
View todo.js
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);
View best_spread.py
import json
import sys
floors = {
'good': 1,
'great': 2,
'ultra': 3,
'weather': 4,
'best': 5,
'hatch': 10,
@Sigafoos
Sigafoos / git-bump
Created Jun 10, 2019
bump the semver tag of a git repo (using go 1.12+ style v4.1.3 tags)
View git-bump
#!/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'))
View charge.json
[{"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 / cat.cow
Created Nov 2, 2018
For use in cowsay
View cat.cow
##
## A cat!
##
## from https://user.xmission.com/~emailbox/ascii_cats.htm
##
$the_cow = <<EOC;
$thoughts
$thoughts
/\\_/\\
>^.^<.---.
View moved_accounts.py
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 / pinewood_derby.py
Last active Jan 14, 2018
WIP derby code. Uses a Circuit Playground Express and OLED Featherwing
View pinewood_derby.py
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)
@Sigafoos
Sigafoos / jpost.py
Last active Sep 21, 2017
Python script to create the file and YAML frontmatter for a Jekyll post
View jpost.py
#!/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"
View twitter_followers.py
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:
View mwr.ino
// 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");
You can’t perform that action at this time.