Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| tell application "Google Chrome" | |
| set theTitle to title of active tab of front window | |
| set theURL to URL of active tab of front window | |
| end tell | |
| tell application "OmniFocus" | |
| set theDoc to default document | |
| set theTask to theTitle | |
| set theNote to theURL | |
| # Requires: requests and readability-lxml (http://pypi.python.org/pypi/readability-lxml) (pip install requests readability-lxml) | |
| import requests | |
| def extract_article_contents(url): | |
| """ | |
| Fetch the main body of content | |
| Returns the html, a plaintext version, the title and subtitle | |
| """ |
| from cloudsearch import connect_cloudsearch, get_document_service | |
| endpoint = 'paste your doc service endpoint here' | |
| service = get_document_service(endpoint=endpoint) # Get a new instance of cloudsearch.DocumentServiceConnection | |
| # Presumably get some users from your db of choice. | |
| users = [ | |
| { | |
| 'id': 1, |
| #!/bin/sh | |
| function matripa | |
| { | |
| BASE="$HOME/code/matripa" | |
| cd $BASE | |
| tmux start-server | |
| tmux new-session -d -s matripa -n vim | |
| tmux new-window -t matripa:1 -n tests |
| #!/usr/bin/env perl | |
| # Parameters supported: | |
| # | |
| # config | |
| # autoconf | |
| # | |
| # Magic markers: | |
| #%# family=auto | |
| #%# capabilities=autoconf |
| #!/bin/bash | |
| a="" | |
| b="" | |
| for i in $(seq 0 10) | |
| do | |
| b=$(git diff --shortstat "@{ $i day ago }") | |
| if [[ "$b" != "$a" ]]; then | |
| echo $(date --date="$i days ago" +%F) $b | |
| fi | |
| a=$b |
| .DS_Store | |
| Gemfile.lock | |
| *.pem | |
| node.json | |
| tmp/* | |
| !tmp/.gitignore |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/ruby | |
| # tp-dailylog.rb - Log TaskPaper tasks completed on the current day to a Day One entry | |
| # Brett Terpstra 2012 <http://brettterpstra.com> | |
| # | |
| # Run it with launchd at 11pm and forget about it | |
| # | |
| # Notes: | |
| # * Uses `mdfind` to locate all .taskpaper files changed in the last day | |
| # * Scans for @done(xxxx-xx-xx) tags in each line matching today's date | |
| # * Does not alter TaskPaper files in any way |