"A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute." - Pierce, TAPL
require 'active_support/time' | |
require 'active_support/testing/time_helpers' | |
require 'rspec/expectations' | |
include ActiveSupport::Testing::TimeHelpers | |
include RSpec::Matchers | |
class Person < Struct.new(:birthday) | |
def age | |
Date.today.year - birthday.year | |
end |
"Consensus is impossible" is a gloss for "there's always an execution that doesn't terminate".
Once you've internalized that you can't distinguish slow nodes from dead nodes, how do you deal with that?
"When you're engaged in a battle of wits with a Sicilian and death is on the line, you certainly need to think about epistemic logic."
A correct distributed program achieves (nontrivial) distributed property X. So we need to ask:
- is X even attainable?
- what's the cheapest* protocol that gets me X? (* according to some cost metric)
In order to setup Rails applications locales on a per request basis, we ought to get such information in a Restful way. That means to always include the desired locale in the URL in order to correctly share context among users through simple links.
That said, Rails internationalization guideline already provides a complete list of options from which we have to choose one. In this document I aim to explain the rationale behind the decision.
# external dependencies | |
require 'rack' | |
require 'tilt' | |
# stdlib dependencies | |
require 'thread' | |
require 'time' | |
require 'uri' | |
# other files we need |
# Shortcut interface to rbenv to quickly pick & switch between Ruby versions. | |
# Usage: | |
# rb <version> [19] | |
# rb <version> [19] <command>... | |
# rb | |
# | |
# A version specifier can be a partial string which will be matched against | |
# available versions and the last match will be picked. The optional "19" | |
# argument switches JRuby or Rubinius to 1.9 mode. | |
# |
From a (mostly) Ruby on Rails developer.
After doing the below everything seems to work (some of it worked before doing anything), including Ruby, Gems, RVM, Homebrew, VirtualBox/Vagrant VMs, Pow, tmux, git, vim.
- Did a full-disk backup that I can restore from
- Moved out
/usr/local
to avoid super slow install, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/:sudo mv /usr/local ~/local
- Upgraded to Yosemite
- Restored
/usr/local
, per option 1 in https://jimlindley.com/blog/yosemite-upgrade-homebrew-tips/:sudo mv ~/local /usr
#!/usr/bin/perl | |
### check_backup.pl | |
# By Nathan Vonnahme, Sept 2011 | |
# An example for "Writing Custom Nagios Plugins in Perl" at the Nagios | |
# World Conference North America 2011. | |
# I. Prologue |
# List of all the valid pdf URLs ever posted to the #Clojure IRC channel. | |
# | |
# Many of them are interesting CS papers others are not that useful. What I've done: | |
# | |
# 1. crawled an IRC history archive for the channel | |
# 2. extract pdf list in a file with: grep -riIohE 'https?://[^[:space:]]+pdf' * > pdf-links.txt | |
# 3. remove dupes: cat pdf-links.txt | sort | uniq > pdf-links-uniq.txt | |
# 4. filter only HTTP 200: cat pdf-links-uniq.txt | xargs curl -o /dev/null --connect-timeout 2 --silent --head --write-out '%{http_code} %{url_effective}\n' | grep "^200" > valid-pdf-links.txt | |
# | |
# Now your choice to download them all or not. If you want, use: cat valid-pdf-links.txt | awk '{print $2}' | xargs wget |