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:
| package main | |
| import ( | |
| "io" | |
| "log" | |
| "mime/multipart" | |
| "net/http" | |
| "os" | |
| "path/filepath" | |
| "runtime" |
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| "sync" |
| // Pipe creates a synchronous in-memory pipe. | |
| // It can be used to connect code expecting an io.Reader | |
| // with code expecting an io.Writer. | |
| // Reads on one end are matched with writes on the other, | |
| // copying data directly between the two; there is no internal buffering. | |
| // It is safe to call Read and Write in parallel with each other or with | |
| // Close. Close will complete once pending I/O is done. Parallel calls to | |
| // Read, and parallel calls to Write, are also safe: | |
| // the individual calls will be gated sequentially. |
| # 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 { |