Skip to content

Instantly share code, notes, and snippets.

@mpage
mpage / gist:084a26befcd76d697879
Created January 26, 2015 07:40
Evaluator for a simple ast. A little mind blowing.
import Data.Map
import Control.Monad
number = return
add = liftM2 (+)
multiply = liftM2 (*)
variable = findWithDefault 0
environment = fromList [("a",3), ("b",4), ("c",7)]
  1. General Background and Overview
SELECT nextval(pg_get_serial_sequence('<table>', '<column>'))
FROM generate_series(0, <num_children>)
> cd /tmp/
> git clone [email protected]:cloudfoundry/warden.git
Cloning into 'warden'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to the list of known hosts.
remote: Counting objects: 7683, done.
remote: Compressing objects: 100% (3938/3938), done.
remote: Total 7683 (delta 3752), reused 7062 (delta 3233)
Receiving objects: 100% (7683/7683), 1.93 MiB | 1.70 MiB/s, done.
Resolving deltas: 100% (3752/3752), done.
> cd warden/
git log --author=mpage --oneline --shortstat --pretty=tformat: --numstat | awk '{ a += $1; d += $2 } END { printf "%d added, %d removed", a, d }'
class User
SCHEMA = Membrane::SchemaParser.parse do
{ "foo" => String,
"bar" => [Integer],
}
end
end
class Org
SCHEMA = Membrane::SchemaParser.parse do
jobs:
- name: dea
template: dea
instances: 0
resource_pool: deas
networks:
- name: default
- name: dea_next
template: dea_next
::Membrane::SchemaParser.parse do
{
"base_dir" => String,
optional("local_route") => String,
"logging" => {
"level" => String,
optional("file") => String,
optional("syslog") => String,
@mpage
mpage / gist:3189344
Created July 27, 2012 17:49
Possible race
it should behave like drain
should cause the warden to exit after all connections are closed
should break connections that are inactive
should break link requests
should break run requests
should break stream requests
should snapshot all containers
should recreate existing containers
should not place existing containers networks back into the pool
terminate called after throwing an instance of 'std::runtime_error'
def self.instance
@instance ||= begin
new.tap { |instance|
prev_handler = Signal.trap("CLD") {
if EM.reactor_running?
EM.add_timer(0) { instance.signal }
end
prev_handler.call if prev_handler
}
}