Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Last active August 29, 2015 14:07
Show Gist options
  • Save pjaspers/eb075748a692ff610e7d to your computer and use it in GitHub Desktop.
Save pjaspers/eb075748a692ff610e7d to your computer and use it in GitHub Desktop.
# Helper functions to interact with the DB of [gifwit](http://gifwit.com)
function gifcount() {
COUNT=$(gifme | wc -l)
echo "Current number of gifs: ${COUNT}"
}
# Usage: `gifme cats`
function gifme() {
db="${HOME}/Library/Containers/stevesmith.gifwit/Data/Library/Application Support/stevesmith.gifwitfiles/gifwit.storedata"
query="select ZURL, ZKEYWORDS from ZIMAGE where ZKEYWORDS LIKE '%$1%';"
/usr/bin/sqlite3 $db $query | awk '{split($0,a,"|"); printf "\033[1;31m%-20s\033[0m: %s\n",a[2],a[1]}'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment