Skip to content

Instantly share code, notes, and snippets.

@John07
John07 / open_wunderlist_tasks.sh
Last active August 29, 2015 14:00
Count the number of open tasks in Wunderlist 2
# counts the number of open tasks in Wunderlist across all lists
# (pretty sure there's a more elegant way of doing this but works for now)
sqlite3 "/Users/USERNAME/Library/Containers/com.wunderkinder.wunderlistdesktop/Data/Library/Application Support/Wunderlist/WKModel.sqlite" "select ZTITLE from ZRESOURCE where ZOWNER1 is not 1 and ZPARENTTASK is null and ZCOMPLETEDAT is null" | wc -l
@John07
John07 / lightroom-exporting.sql
Last active August 29, 2015 14:04
An incomplete collection of ugly sqlite commands to export metadata from a Lightroom catalog. You can export Lightroom keywords, color labels, collections and more depending on your sqlite skills. Only tested with a Lightroom 2 catalog! (Note that this is not a complete script but rather a collection of commands that may need to be modified to run)
sqlite3 backup-catalog.lrcat
.output export.txt
-- get all keywords with their id
SELECT id_local, name FROM AgLibraryKeyword;
-- get list of all files with keyword id 88890
SELECT stackParent_fileName, stackParent____colorLabels, rating FROM Adobe_images AS a JOIN AgLibraryKeywordImage AS b WHERE b.tag=88890 AND a.id_local=b.image;
-- get list of all files for keyword Bob
@John07
John07 / to_mediawiki.xsl
Created April 28, 2011 11:25
Convert Pentabarf schedule.xml to mediawiki table
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no" encoding="utf-8" />
<xsl:template match='text()|@*' />
<xsl:template match="event">
|-
| ? || ? || FOSSGIS2011-<xsl:value-of select="@id" />-<xsl:value-of select="normalize-space(language)" /><xsl:if test="not(normalize-space(language))">de</xsl:if>-<xsl:value-of select="slug" /> || <xsl:value-of select="title" /> || <xsl:for-each select="persons/person"><xsl:value-of select="." /><xsl:text> </xsl:text></xsl:for-each> || <xsl:value-of select="../../@date" /><xsl:text> </xsl:text><xsl:value-of select="start" /> || <xsl:value-of select="room" />
</xsl:template>
@John07
John07 / to_csv.xsl
Created April 28, 2011 11:27
Convert Pentabarf schedule.xml to csv
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="no" encoding="utf-8" />
<xsl:template match='text()|@*' />
<xsl:template match="event">
FOSSGIS2011-<xsl:value-of select="@id" />-<xsl:value-of select="normalize-space(language)" /><xsl:if test="not(normalize-space(language))">de</xsl:if>-<xsl:value-of select="slug" />;<xsl:value-of select="title" />;<xsl:for-each select="persons/person"><xsl:value-of select="." /><xsl:text> </xsl:text></xsl:for-each>; <xsl:value-of select="../../@date" /><xsl:text> </xsl:text><xsl:value-of select="start" />;<xsl:value-of select="room" />
</xsl:template>
@John07
John07 / gist:3782405
Created September 25, 2012 14:51
wkpdf debug log
webView <WebView: 0x102050190> didCommitLoadForFrame <WebFrame: 0x1181b4bd0>
identifierForInitialRequest request: <NSMutableURLRequest https://plusone.google.com/_/apps-static/_/ss/plusone/ver=-yf4rtzu2qv6i/am=!QiLm8C5UadSNAbdIjAs/bf=BA/r=O/rs=AItRSTPBu5k2X1PY5oo7Zv2WE0tHa20H2g> dataSource: <WebDataSource: 0x11817bf90> (resource id: 165)
didFinishLoadingFromDataSource identifier: 151 dataSource: <WebDataSource: 0x11817bf90>
didFinishLoadingFromDataSource identifier: 159 dataSource: <WebDataSource: 0x118183e10>
webView <WebView: 0x102050190> didCommitLoadForFrame <WebFrame: 0x1181923f0>
webView <WebView: 0x102050190> didFinishLoadForFrame <WebFrame: 0x1181923f0>, parentFrame: <WebFrame: 0x1030ad4b0>
didFinishLoadingFromDataSource identifier: 150 dataSource: <WebDataSource: 0x1181af6f0>
didFinishLoadingFromDataSource identifier: 149 dataSource: <WebDataSource: 0x10304a400>
webview <WebView: 0x102050190> didStartProvisionalLoadForFrame <WebFrame: 0x118168d50>
@John07
John07 / Wunderlist 2 sqlite Export.sh
Last active December 11, 2015 08:28
Wunderlist 2 drops the email and print export features and also creates a new database. It's still a sqlite database that you can look at with something like http://sqlitebrowser.sourceforge.net/. You can export data by running commands like the example below (make a local copy of the database to your desktop before if you're not familiar with s…
# location of the Wunderlist 2 database (App Store version)
~/Library/Containers/com.wunderkinder.wunderlistdesktop/Data/Library/Application Support/Wunderlist/WKModel.sqlite
# example
# get title of all tasks in list 400
sqlite3 WKModel.sqlite "SELECT rowid, ZTITLE FROM ZRESOURCE WHERE ZTASKLIST = 400 ORDER BY rowid;"
@John07
John07 / Instacast 2 favorites export.sh
Last active December 15, 2015 09:49
Export a list of your favorite podcast episodes from Instacast 2
# get the db.sqlite file from Instacast (e.g. with iExplorer 2 http://www.macroplant.com/downloads.php)
# copy it on your desktop and run
sqlite3 db.sqlite
.output instacast-favorites.txt
SELECT FEEDS.title, EPISODES.title, EPISODES.link, datetime(EPISODES.pubdate, 'unixepoch', 'localtime'), CONSUMABLES.guid
FROM CONSUMABLES
LEFT OUTER JOIN EPISODES on CONSUMABLES.guid = EPISODES.guid
LEFT OUTER JOIN FEEDS on EPISODES.feed_id = FEEDS.id
WHERE CONSUMABLES.starred = 1;
@John07
John07 / chapter_marks.sh
Created November 16, 2015 18:53
Read a podcast mp3 file and print a list of its chapter marks. Useful if your podcast client of choice doesn't yet support chapter marks
# read a podcast mp3 file and print a list of its chapter marks
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3
# more readable, timestamps with seconds
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3 | awk -F "," '{print $5 " " $7 " " $8}' | sed 's/\.[0-9]*\ /\ /g'
# more readable, timestamps without seconds
ffprobe -v quiet -show_chapters -pretty -print_format csv *.mp3 | awk -F "," '{print $5 " " $7 " " $8}' | sed 's/\:[0-9][0-9]\.[0-9]*\ /\ /g'
@John07
John07 / open_chrome_tab_with_safari.applescript
Last active October 25, 2017 08:45
Open currently active Chrome tab with Safari. Can be used with Textexpander or as a service
--
-- open currently active Chrome tab with Safari
-- forked from https://gist.github.com/3151932 and https://gist.github.com/3153606
--
property theURL : ""
tell application "Google Chrome"
set theURL to URL of active tab of window 0
end tell
if appIsRunning("Safari") then
@John07
John07 / Short-URL converter.sh
Last active May 21, 2019 15:08
Tiny shell script for use with Textexpander to take a (Twitter) short URL and resolve it to the full URL Add it to Textexpander as a shell script, copy the shortened URL, type your Textexpander command and then the full URL will be pasted in
#!/bin/bash
URL=$(pbpaste)
curl "$URL" --insecure --write-out %{redirect_url}