Skip to content

Instantly share code, notes, and snippets.

💻
Typing...

Spencer Bliven sbliven

View GitHub Profile
@sbliven
sbliven / google-authenticator.rb
Last active Mar 8, 2019 — forked from Dan-Q/google-authenticator.rb
Command-line Google Authenticator (TOTP)
View google-authenticator.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
# encoding: utf-8
#
# TOTP implementation (google authenticator)
#
# Reads ~/.google-authenticator-accounts for account info.
# For security, you should run `chmod 600 ~/.google-authenticator-accounts
#
# Changelog:
@sbliven
sbliven / test10.sh
Created Feb 6, 2019
Generate evenly-spaced heic file for testing Mac dynamic wallpapers
View test10.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
JSONFILE="${1:-wallpapper.json}"
HEICFILE="${2:-wallpapper.heic}"
blocks=()
for ((a=-90;a<=90;a+=10)); do
for ((z=0; z<360; z+=10)); do
@sbliven
sbliven / Sync Calendars.scpt
Created Dec 17, 2018
Copies events between calendars in Apple Calendar.app
View Sync Calendars.scpt
-- Syncronize several calendars
--
-- The calendars to be synced must be set by UID in the 'targetCalendarIDs' variable.
-- UIDs can be read using the 'Get Calendar' script.
--
-- When run, copies each selected event to other calendars in the target list.
--
-- Author: Spencer Bliven (spencer.bliven@gmail.com)
--
-- Event selection code from http://www.johneday.com/1086/reference-selected-calendar-events-applescript
@sbliven
sbliven / LICENSE.md
Created Mar 28, 2018
ODC Public Domain Dedication and Licence (PDDL)
View LICENSE.md

ODC Public Domain Dedication and Licence (PDDL)

A lay explaination of this license is available at https://opendatacommons.org/licenses/pddl/summary/. The full legal text is also available online at https://opendatacommons.org/licenses/pddl/1.0/.

Preamble

The Open Data Commons – Public Domain Dedication & Licence is a document intended to allow you to freely share, modify, and use this work for any purpose and without any restrictions. This licence is intended for use on databases or their contents (“data”), either together or individually.

Many databases are covered by copyright. Some jurisdictions, mainly in Europe, have specific special rights that cover databases called the “sui generis” database right. Both of these sets of rights, as well as other legal rights used to protect databases and data, can create uncertainty or practical difficulty for those wishing to share databases and their underlying data but retain a limited amount of rights under a “some rights reserved” approach to licensing as

@sbliven
sbliven / Lunar Lander.ipynb
Last active Mar 6, 2018
Calculations for DanQ's Lunar Lander game (https://danq.me/2018/03/03/lunar-lander/)
View Lunar Lander.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sbliven
sbliven / nab2ynab.R
Created Dec 11, 2017
Convert bank transaction data from Neue Aargauer Bank CSV files to the format expected by youneedabudget.com
View nab2ynab.R
#!/usr/bin/env Rscript
library(readr)
library(dplyr)
library(magrittr)
args = commandArgs(trailingOnly=TRUE)
if (length(args) != 2) {
stop("usage: nab2ynab.R nab.csv ynab.csv", call.=FALSE)
}
@sbliven
sbliven / show_ip.py
Created Dec 5, 2017
Script to show current IP address on SenseHat
View show_ip.py
from sense_hat import SenseHat
import socket
def get_ip():
# overridden by /etc/hosts, so doesn't work for us
#hosts_ips = [ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1]
# try to connect to google
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 53))
@sbliven
sbliven / 99_telegram
Created Nov 7, 2017
Raspberry Pi setup to send IP changes via telegram
View 99_telegram
# /lib/dhcpcd/dhcpcd-hooks/99-telegram
#
# Notify telegram chat of ip changes
# man dhcpcd-run-hooks for variables
TELEGRAM=/home/pi/bin/telegram
if $if_up; then
case "$reason" in
BOUND|BOUND6)
@sbliven
sbliven / interfaces
Created Oct 10, 2017
ZHAW Raspberry Pi network settings.
View interfaces
# /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
@sbliven
sbliven / JupyterGenomeDiagram.ipynb
Created Aug 22, 2017
Example of BioPython #1329 (fixed version)
View JupyterGenomeDiagram.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.