left half ⌘+⌥+⌃+j
right half ⌘+⌥+⌃+l
top half ⌘+⌥+⌃+i
bottom half ⌘+⌥+⌃+,
center ⌘+⌥+⌃+k
top left ⌘+⌥+⌃+u
top right ⌘+⌥+⌃+o
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Generates a pre-signed S3 URL using a valid key pair that lasts for 20 years. | |
Reference: http://forrst.com/posts/Python_method_for_creating_authenticated_s3_URLs-uUM | |
""" | |
import base64, hmac, os, sha, sys, time, urllib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# Dependencies: | |
- https://github.com/russross/blackfriday-tool | |
- http://wkhtmltopdf.org/ | |
TODO: this whole thing should be put under test. | |
TODO: it would be great to know how long a project (or task) is taking | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
"sync" | |
) | |
func main() { | |
var waiter sync.WaitGroup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package utils | |
// toInt is a port of the little endian path of the .Net BitConverter.ToInt32 | |
// function. It does exactly what toIntReversed (below) does but it operates | |
// on a slice that is already in the expected order. If your slice is in | |
// reverse order, use toIntReversed (below) instead. | |
// For 4-byte integers the gist of this algorithm is: | |
// return int(b[0]) | int(b[1])<<8 | int(b[2])<<16 | int(b[3])<<24 | |
// The for loop implementation allows byte slices of arbitrary length | |
// (up to 4 bytes because we return an int) to be converted to integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
"strconv" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// traverse recursively finds a value in a JSON object that can contain fields and values, | |
// as long as all values are only JSON objects with similarly defined objects with fields and values. | |
// This works with structures like the US and International Street APIs. | |
// example: traverse(d, "components", "primary_number) // will return the primary number of the candidate) | |
func traverse(i interface{}, keys ...string) interface{} { | |
var ( | |
found bool | |
object map[string]interface{} | |
) | |
object, found = i.(map[string]interface{}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package something | |
import "testing" | |
type MyFixture struct { | |
*testing.T | |
sut Something // stuff under test | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"net/http/httputil" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package web | |
import ( | |
"bytes" | |
"reflect" | |
"regexp" | |
"fmt" | |
"errors" | |
"strings" | |
) |