Skip to content

Instantly share code, notes, and snippets.

Roo Reynolds rooreynolds

Block or report user

Report or block rooreynolds

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rooreynolds
rooreynolds / CountEmail.gs
Last active Aug 23, 2017
Gmail email stats (Google Sheets script)
View CountEmail.gs
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 / things_completed.rb
Created Jan 4, 2017
How many things have I done today, according to the Things app?
View things_completed.rb
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 Jan 4, 2017
What's on Radio 4 right now? via Node JS
View radio4-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);
View keybase.md

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:

View KSP_arduino.ino
/*
* 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 / BlinkyBike.ino
Created Aug 22, 2014
BlinkyTape bike indicators
View BlinkyBike.ino
#include <FastLED.h>
#include <avr/pgmspace.h>
#include <Animation.h>
#include "steady.h"
#include "left.h"
#include "right.h"
#include <Button.h> // https://github.com/virgildisgr4ce/Button
#define LED_COUNT 60
struct CRGB leds[LED_COUNT];
@rooreynolds
rooreynolds / pivotal_parse.rb
Last active Dec 31, 2015
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]
View pivotal_parse.rb
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 Dec 29, 2015
Things-completed-today-meter
View voltmeter_things.ino
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;
@rooreynolds
rooreynolds / get_completed_and_created.sh
Created Jul 3, 2012
Things - publish number or items completed and created today to Cosm
View get_completed_and_created.sh
# get simple CSV showing number of items completed and created today
sqlite3 -csv ~/Library/Application\ Support/Cultured\ Code/Things\ beta/ThingsLibrary.db "SELECT
'completed', case when count then count else '0' end from (SELECT date(ZSTOPPEDDATE, 'unixepoch', '+31 years', 'localtime') as date,
count(Z_PK) as count from ZTHING WHERE ZSTATUS = 3 and date = (SELECT date('now')));
SELECT 'created', case when count then count else '0' end from (SELECT date(ZCREATIONDATE, 'unixepoch', '+31 years', 'localtime') as date,
count(Z_PK) as count FROM ZTHING WHERE ZCREATIONDATE != '' and date = (SELECT date('now')));"
@rooreynolds
rooreynolds / sysinfo.sh
Created Jul 3, 2012
Publish Raspberry Pi system stats to Cosm
View sysinfo.sh
loadAvg=`uptime | cut -f 6 -d,`
upDays=`uptime | cut -f 4 -d " "`
upHours=`uprecords -s | sed -n '3p' | cut -c 23-25`
upMinutes=`uprecords -s | sed -n '3p' | cut -c 27-28`
upD=`echo "scale=5;$upDays + ($upHours / 24) + ($upMinutes / 24 / 60)" | bc`
users=`w | head -1 | cut -f 3 -d, | awk '{print $1}'`
memFree=`free -m | grep Mem | awk '{print $4}'`
swapFree=`free -m | grep Swap | awk '{print $4}'`
processes=`ps aux | wc -l`
wget -O - --header="X-Http-Method-Override:put" \
You can’t perform that action at this time.