Skip to content

Instantly share code, notes, and snippets.

View rooreynolds's full-sized avatar

Roo Reynolds rooreynolds

View GitHub Profile
@rooreynolds
rooreynolds / things_beta_list_completed_tasks.sh
Created March 9, 2012 23:39
Extracting useful data from Things (Cloud beta) via its SQLite database
#Completed tasks (showing their title, start date, completion date and time to complete in days)
sqlite3 -csv -header ~/Library/Application\ Support/Cultured\ Code/Things\ beta/ThingsLibrary.db "SELECT
substr(ZTITLE,0,26) as title,
datetime(ZCREATIONDATE, 'unixepoch', '+31 years', 'localtime') as startdate,
datetime(ZSTOPPEDDATE, 'unixepoch', '+31 years', 'localtime') as completeddate,
round(julianday(datetime(ZSTOPPEDDATE, 'unixepoch', '+31 years', 'localtime')) - julianday
(datetime(ZCREATIONDATE, 'unixepoch', '+31 years', 'localtime')),5) as age
FROM ZTHING WHERE ZSTATUS = 3 ORDER BY completeddate;
@rooreynolds
rooreynolds / CountEmail.gs
Last active June 2, 2022 20:09
Gmail email stats (Google Sheets script)
function CountEmail() {
var starredEmails = GmailApp.search('is:starred');
var newunreadEmails = GmailApp.search('is:unread label:inbox');
var urgentEmails = GmailApp.search('label:urgent');
var waitingEmails = GmailApp.search('label:waiting-for');
var chaseEmails = GmailApp.search('label:chase');
var draftEmails = GmailApp.search('in:draft');
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
@rooreynolds
rooreynolds / Arduino_physical_mute_key.ino
Last active January 26, 2022 07:07
Arduino / Teensyduino code for a keyboard interface to toggle mute and camera controls in Google Meet
/*
* A simple arduino app to send a keyboard combination (Command + F1)
* when a button is pushed. This key combination can, using an app like
* FastScripts (https://red-sweater.com/fastscripts/) or similar,
* trigger a script to perform a specific action, for example
* to mute the teleconferencing app of your choice.
*
* Useful scripts for running at the desktop side:
* - Google Meet: https://github.com/aezell/mutemeet
* - Zoom: https://gist.github.com/mgaruccio/15734cb2f1442c457f0fa25dd838cc6d
//inspired by https://twitter.com/paulpod/status/1330091111889690628
#include <Arduino.h>
#include <TM1637Display.h>
#include <Bounce2.h>
#define CLK 2
#define DIO 3
#define pin_button A0
@rooreynolds
rooreynolds / KSP_arduino.ino
Last active February 19, 2019 18:21
KSP controller
/*
* Use an Arduino to control an LCD display and some volt meters.
* Pass through data from a serial app
* (Future versions will display selected data according to switch toggles. Mainly a stub for now)
*
* Roo Reynolds - rooreynolds.com
*/
#include <Bounce.h>
@rooreynolds
rooreynolds / things_completed.rb
Created January 4, 2017 21:58
How many things have I done today, according to the Things app?
require 'sqlite3'
require 'rubygems'
`cp ThingsLibrary.db ThingsLibrary_cache.db`
db = SQLite3::Database.new("ThingsLibrary_cache.db")
db.results_as_hash = true
row = db.get_first_row( "SELECT count(ZTHING.Z_PK) as today FROM ZTHING LEFT OUTER JOIN ZTHING PROJECT on ZTHING.ZPROJECT = PROJECT.Z_PK LEFT OUTER JOIN ZTHING AREA on ZTHING.ZAREA = AREA.Z_PK WHERE ZTHING.ZSTARTDATE != '' and ZTHING.ZSTATUS != 3 and ZTHING.ZSTATUS != 2 and ZTHING.ZTRASHED = 0 and ZTHING.ZSTART = 1 ORDER BY ZTHING.ZTODAYINDEX;" )
today = row['today']
@rooreynolds
rooreynolds / radio4-node.js
Created January 4, 2017 20:30
What's on Radio 4 right now? via Node JS
const request = require('request')
,url = 'http://www.bbc.co.uk/radio4/programmes/schedules/fm.json'
request(url, (error, response, body)=> {
if (!error && response.statusCode === 200) {
const data = JSON.parse(body)
var schedule=data.schedule.day.broadcasts;
var myDate = new Date();
for (var i=0; i<schedule.length; i++) {
var startDate = Date.parse(schedule[i].start);
@rooreynolds
rooreynolds / pivotal_parse.rb
Last active December 31, 2015 05:49
Simple Ruby script to parse Pivotal Tracker CSV export and extract useful data. See comments below for usage. [Revision 5: adds output of total points per sprint]
require 'csv'
require 'sqlite3'
def setupDB(db, csv_file)
db.execute("drop table if exists stories")
db.execute("create table stories(id, labels, iterationend, created, accepted, size, requester, owner, type)")
CSV.foreach(File.path(csv_file), :headers => true) do |col|
db.execute("insert into stories(id, labels, iterationend, created, accepted, size, requester, owner, type) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
[col['Id'],
@rooreynolds
rooreynolds / voltmeter_things.ino
Last active December 29, 2015 18:49
Things-completed-today-meter
const int voltPin = 4;
const int maxVoltAdjust = 230; // analog out is max 255, but for my voltmeter 230 == 100%
void setup() {
pinMode(voltPin, OUTPUT);
Serial.begin(19200);
}
String inData;

Keybase proof

I hereby claim:

  • I am rooreynolds on github.
  • I am rooreynolds (https://keybase.io/rooreynolds) on keybase.
  • I have a public key whose fingerprint is D733 6882 4C2A 9659 D64B D38D 751F A66B CEEE B7A6

To claim this, I am signing this object: