Skip to content

Instantly share code, notes, and snippets.

View rooreynolds's full-sized avatar

Roo Reynolds rooreynolds

View GitHub Profile
@rooreynolds
rooreynolds / get_completed_and_created.sh
Created July 3, 2012 17:58
Things - publish number or items completed and created today to Cosm
# 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 July 3, 2012 17:53
Publish Raspberry Pi system stats to Cosm
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" \
@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;