Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# ~/.gitconfig from @boblet | |
# initially based on http://rails.wincent.com/wiki/Git_quickstart | |
[core] | |
excludesfile = /Users/oli/.gitignore | |
legacyheaders = false # >git 1.5 | |
quotepath = false | |
# http://stackoverflow.com/questions/136178/git-diff-handling-long-lines | |
pager = less -r | |
# if ↑ doesn’t work, try: pager = less -+$LESS -FRX |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
/** | |
reference - | |
https://developers.google.com/accounts/docs/OAuth2WebServer | |
https://code.google.com/apis/console/ | |
https://developers.google.com/+/api/latest/ | |
**/ | |
////handle all requests here | |
function doGet(e) { |
from datetime import datetime | |
from sqlalchemy import Column, Integer, DateTime, ForeignKey | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.ext.declarative import declared_attr | |
from flask_security import current_user | |
class AuditMixin(object): | |
created_at = Column(DateTime, default=datetime.now) | |
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now) |
If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.
Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.
The simplest way to add an alias for a specific git command is to use a standard bash alias.
# .bashrc
import groovy.xml.MarkupBuilder | |
new MarkupBuilder().kml(xmlns : 'http://www.opengis.net/kml/2.2') { | |
new File(args?.size() ? args[0] : '.').eachFileMatch(~/.*\.gpx/) { file -> | |
new XmlParser().parse(file).trk.each { trk -> | |
trk.trkseg.each { trkseg -> | |
def geo = "" | |
trkseg.trkpt.each { trkpt -> | |
geo += "${trkpt.'@lon'},${trkpt.'@lat'}\n" | |
} |
library(ggplot2) | |
library(maps) | |
library(mapproj) | |
############################################################################### | |
# Step 1: Get data from Foursquare | |
# If you already have it, then great :) Otherwise, you can use RPI. The source | |
# is listed below, and there are instructions for getting keys in the readme. | |
# RPI: https://github.com/johnschrom/RPI |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
YourTrelloKey
with this hash.YourTrelloToken
with this looong hash.