Skip to content

Instantly share code, notes, and snippets.

View cezarsa's full-sized avatar

Cezar Sá Espinola cezarsa

  • Brasília - DF / Brazil
  • 22:13 (UTC -03:00)
View GitHub Profile
#!/bin/bash
cat<<-EOF > /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io
Requires=docker.socket
[Service]
Environment="TMPDIR=/var/tmp/"
ExecStartPre=/bin/mount --make-rprivate /
docker:
servers:
- http://127.0.0.1:4243
@cezarsa
cezarsa / migrate.py
Last active August 29, 2015 14:04
Migrate to docker cluster in Tsuru 0.6.0
import redis
import os
redis_prefix = os.environ.get('REDIS_PREFIX', 'docker-cluster')
redis_host = os.environ.get('REDIS_HOST', 'localhost')
redis_port = int(os.environ.get('REDIS_PORT', '6379'))
mongo_uri = os.environ.get('MONGO_URI')
mongo_db = os.environ.get('MONGO_DB')
package main
import (
"fmt"
"github.com/garyburd/redigo/redis"
"time"
)
func main() {
pool := &redis.Pool{

After creating an index in a capped collection, sorting it in reverse natural order doesn't work anymore.

$ mongod --version
db version v2.6.1
2014-06-05T13:45:27.884+0000 git version: 4b95b086d2374bdcfcdf2249272fb552c9c726e8

This works fine and as expected:

$ t app-create sample buildpack
App "sample" is being created!
Use app-info to check the status of the app and its units.
Your repository for "sample" project is "git@192.168.50.4:sample.git"
(sample)[14:00] cezar.sa@dagobah [/.../code/tsuru/sample_app] (master)
$ git push tsuru master
Counting objects: 63, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (63/63), 6.51 KiB | 0 bytes/s, done.
require File.expand_path('../boot', __FILE__)
# require 'rails/all'
require "action_controller/railtie"
require "action_mailer/railtie"
require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
@cezarsa
cezarsa / dabblet.css
Created April 30, 2013 21:00
Untitled
div {
box-shadow:
0 -1em 0 1px #000,
0 -2em 0 1px #000,
0 1em 0 1px #000,
0 2em 0 1px #000,
-1em 0 0 1px #000,
-2em 0 0 1px #000,
1em 0 0 1px #000,
2em 0 0 1px #000;
@cezarsa
cezarsa / dabblet.css
Created February 25, 2013 18:43
Untitled
div {
width: 0;
border-right: 10px solid #000;
border-top: 10px solid transparent;
border-bottom: 10px solid transparent;
position: relative;
}
@cezarsa
cezarsa / robot.js
Created December 1, 2012 01:23
Kaiju Banzai
function Robot(robot) {}
Robot.status = 0;
Robot.enemy = {};
Robot.enemy.posX;
Robot.enemy.posY;
Robot.enemy
// well, we need to do something...
// whenever our robot is idle, this method gets called.
Robot.prototype.onIdle = function(ev) {