Skip to content

Instantly share code, notes, and snippets.

@rooreynolds
Created July 3, 2012 17:58
Show Gist options
  • Save rooreynolds/3041389 to your computer and use it in GitHub Desktop.
Save rooreynolds/3041389 to your computer and use it in GitHub Desktop.
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')));"
# posts things stats (via ./get_completed_and_created.sh) to Cosm
curl --request PUT \
--data-binary "`./get_completed_and_created.sh`" \
--header "X-ApiKey: YOUR_COSM_API_KEY" \
--verbose \
http://api.cosm.com/v2/feeds/YOUR_COSM_API_KEY.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment