Skip to content

Instantly share code, notes, and snippets.

@patrickwelker
patrickwelker / gist:2405115
Created April 17, 2012 10:26 — forked from rfbrazier/gist:1077160
Create an OmniFocus task from the current URL of the active Chrome tab
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
@billthornton
billthornton / gist:2404165
Created April 17, 2012 07:24
Extracting article contents
# 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
"""
@imlucas
imlucas / add_users.py
Created April 12, 2012 12:58
Using Amazon Cloudsearch with Python and Boto
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,
@krisleech
krisleech / matripa
Created March 30, 2012 09:40
automate tmux for quickstart rails project
#!/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
@rafl
rafl / elasticsearch_cache
Created March 22, 2012 16:32
Munin ElasticSearch plugins
#!/usr/bin/env perl
# Parameters supported:
#
# config
# autoconf
#
# Magic markers:
#%# family=auto
#%# capabilities=autoconf
@juanpabloaj
juanpabloaj / lastDays.sh
Created March 20, 2012 16:14
git: latest changes grouped by day
#!/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
@karmi
karmi / .gitignore
Created March 16, 2012 16:09
Bootstrap, install and configure ElasticSearch with Chef Solo
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@ttscoff
ttscoff / tp-dailylog.rb
Created February 26, 2012 04:33
Daily background logger to write completed TaskPaper tasks (system-wide) to a Day One entry
#!/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