Skip to content
View mesos-docker
# ZooKeeper
$ sudo docker run --net=host jplock/zookeeper:3.4.6
## It's important to specify --ip=<ip> and --hostname=<ip> parameters
$ sudo docker run --net=host mesosphere/mesos-master:0.21.0-1.0.ubuntu1404 --ip= --hostname= --zk=zk:// --work_dir=/opt/ --quorum=1

Fix memory cgroup configuration for lxc-docker on Ubuntu 14.04

Step 1: enable hierarchical memory management

Drop memory-cg.conf into /etc/init. The upstart job will ensure that the memory cgroup is configured with hierarchical stats tracking before systemd-logind and/or docker start creating cgroups.

(Yes, it's mostly a crude hack with an obscure way of syncing with cgroup-lite. That can't be helped, though)

View gist:f2f7d53db1c17d508ee4
# /etc/security/limits.conf
* soft nofile 999999
* hard nofile 999999
root soft nofile 999999
root hard nofile 999999
# /etc/sysctl.conf
# sysctl for maximum tuning
View coreos-openstack
Step one:
$ wget
$ bunzip2 coreos_production_openstack_image.img.bz2
$ glance image-create --name CoreOS \
--container-format bare \
--disk-format qcow2 \
mkdir panamax
cd panamax
curl -O
sudo su
./coreos install --stable
View method_missing.js
// This will only work in environments that support ES6 Proxies.
// As of right now, that's pretty much only Firefox.
function Refrigerator(foods) {
this.foods = foods;
return new Proxy(this, {
get: function (receiver, name) {
if (name in receiver) {
View capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')
View advanced-style-ruby
def triangle(a, b, c)
raise TriangleError if [a,b,c].min <= 0
x, y, z = [a,b,c].sort
raise TriangleError if x + y <= z
[:equilateral,:isosceles,:scalene].fetch([a,b,c].uniq.size - 1)
View common-style-ruby
def triangle(a, b, c)
if a == 0 || b == 0 || c == 0
raise TriangleError
if((a+b < c) || (a+c < b) || (b+c < a))
raise TriangleError
if a == b && b == c # && a == c
elsif a == b || b == c || c == a
Something went wrong with that request. Please try again.