Skip to content

Instantly share code, notes, and snippets.

@tpo
tpo / Pascals_WITH.rb
Created March 7, 2011 13:40
Pascal's WITH in ruby
# for a long time I wondered why Ruby didn't have Pascal's "WITH"
# construct. It's completely trivial to implent though...
def with object, &block
object.instance_eval(&block)
end
# now instead of needing to name your object all the time:
object = Object.new
@tpo
tpo / autodefine.rb
Last active August 29, 2015 14:00
define? considered evil
#!/usr/bin/ruby
# tested with ruby 1.9.3p194
puts "this will not print" if defined?(x)
if false
puts "this neither"
x = "foobar"
end
@tpo
tpo / 31c3 presentation reviews.md
Last active January 1, 2016 10:22
Reviews der Präsentationen am 31. Chaos Computer Congress (31c3) - 2014
@tpo
tpo / understanding_patroni.md
Last active June 11, 2020 13:41
understanding patroni

There are two fundamental stages in Patroni:

  • bootstrap
  • running the cluster

Bootstrap stage

In the bootstrap stage, Patroni will: