This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
| # Add field | |
| echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}' | |
| # { | |
| # "hello": "world", | |
| # "foo": "bar" | |
| # } | |
| # Override field value | |
| echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}' | |
| { |
| #!/usr/bin/env python | |
| """ | |
| xlsx2tsv filename.xlsx [sheet number or name] | |
| Parse a .xlsx (Excel OOXML, which is not OpenOffice) into tab-separated values. | |
| If it has multiple sheets, need to give a sheet number or name. | |
| Outputs honest-to-goodness tsv, no quoting or embedded \\n\\r\\t. | |
| One reason I wrote this is because Mac Excel 2008 export to csv or tsv messes | |
| up encodings, converting everything to something that's not utf8 (macroman |
| # Greatest common divisor of more than 2 numbers. Am I terrible for doing it this way? | |
| def gcd(*numbers): | |
| """Return the greatest common divisor of the given integers""" | |
| from fractions import gcd | |
| return reduce(gcd, numbers) | |
| # Least common multiple is not in standard libraries? It's in gmpy, but this is simple enough: | |
| def lcm(*numbers): |
| #!/bin/sh | |
| ## Information | |
| ## http://carlo-hamalainen.net/blog/2007/12/11/installing-minion-pro-fonts/ | |
| ## http://www.ctan.org/tex-archive/fonts/mnsymbol/ | |
| ## 0: Install | |
| ## http://www.lcdf.org/type/ | |
| ## I used --without-kpathsea to configure (with MacTeX 2011): | |
| ## | |
| ## ./configure --without-kpathsea |
#System Design Cheatsheet
Picking the right architecture = Picking the right battles + Managing trade-offs
##Basic Steps
| package trie | |
| import ( | |
| "container/vector" | |
| "sort" | |
| ) | |
| // A 'set' structure, that can hold []byte objects. | |
| // For any one []byte instance, it is either in the set or not. | |
| type Trie struct { |
| // Traverses an arbitrary struct and translates all stings it encounters | |
| // | |
| // I haven't seen an example for reflection traversing an arbitrary struct, so | |
| // I want to share this with you. If you encounter any bugs or want to see | |
| // another example please comment. | |
| // | |
| // The MIT License (MIT) | |
| // | |
| // Copyright (c) 2014 Heye Vöcking | |
| // |
| // packageList returns the list of packages in the dag rooted at roots | |
| // as visited in a depth-first post-order traversal. | |
| func packageList(roots []*Package) []*Package { | |
| seen := map[*Package]bool{} | |
| all := []*Package{} | |
| var walk func(*Package) | |
| walk = func(p *Package) { | |
| if seen[p] { | |
| return |