This article is now published on my website: Prefer Subshells for Context.
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
brew update | |
brew versions FORMULA | |
cd `brew --prefix` | |
git checkout HASH Library/Formula/FORMULA.rb # use output of "brew versions" | |
brew install FORMULA | |
brew switch FORMULA VERSION | |
git checkout -- Library/Formula/FORMULA.rb # reset formula | |
## Example: Using Subversion 1.6.17 | |
# |
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
<meta property="og:title" content="{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}" /> | |
<meta property="og:description" content="{{ description | strip_html | condense_spaces | truncate:150 }}" /> | |
<meta property="og:url" content="{{ canonical }}" /> | |
<meta property="og:image" content="{% if page.ogp_image %}{{ page.ogp_image }}{% else %}{{ site.default_ogp_image }}{% endif %}" /> | |
<meta property="og:author" content="{{ site.author }}" /> | |
<meta property="og:site_name" content="{{ site.title }}" /> | |
<meta property="og:locale" content="{{ site.facebook_locale }}" /> | |
<meta property="og:type" content="{% if page.index %}blog{% else %}article{% endif %}" /> | |
<meta property="fb:app_id" content="{{ site.facebook_app_id }}" /> |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
// Excerpt from: https://github.com/Animatron/player/blob/master/anm.collisions.js | |
function edgeTest(p1, p2, p3, r2) { | |
var rot = [ -(p2[1] - p1[1]), | |
p2[0] - p1[0] ]; | |
var ref = (rot[0] * (p3[0] - p1[0]) + | |
rot[1] * (p3[1] - p1[1])) >= 0; | |
for (var i = 0, il = r2.length; i < il; i+=2) { |
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
# Title: | |
# Octopress HTML5 Audio Tag | |
# http://antoncherkasov.me/projects/octopress-plugins | |
# Author: | |
# Anton Cherkasov | |
# http://antoncherkasov.me | |
# [email protected] | |
# Syntax: | |
# {% audio url/to/mp3 %} | |
# {% audio url/to/mp3 url/to/ogg %} |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)
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
class Graph: | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): | |
self.nodes.add(value) | |
def add_edge(self, from_node, to_node, distance): |
OlderNewer