Skip to content

Instantly share code, notes, and snippets.

View rochacon's full-sized avatar

Rodrigo Chacon rochacon

  • Remote
  • 13:16 (UTC -03:00)
View GitHub Profile
@rochacon
rochacon / balanced-app.log
Last active August 29, 2015 14:03
Sample of load balanced Deis app
% http GET http://example-app.d.rochacon.me
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 32
Content-Type: text/html; charset=UTF-8
Date: Fri, 11 Jul 2014 15:17:31 GMT
Server: nginx/1.6.0
X-Deis-Upstream: 10.13.0.134:49153
69b0ee40084e4efdae5d2f9ddfbbfc49
@rochacon
rochacon / clone-container.go
Created July 8, 2014 19:11
Simple way to clone a container keeping its environment variables
package main
import (
"fmt"
"github.com/fsouza/go-dockerclient"
"log"
"os"
)
func main() {
@rochacon
rochacon / docker-userdata.sh
Created July 1, 2014 01:40
Simple userdata to install and configure a Docker node
#!/bin/bash
# This will install the latest version of Docker and configure it to
# listen to /var/run/docker.sock and 0.0.0.0:2375
ufw allow ssh
ufw limit ssh
ufw enable
apt-get update -y && apt-get upgrade -yq
curl -s https://get.docker.io/ubuntu/ | sh
sed -i .bak -e 's/^DEFAULT_FORWARD_POLICY.*$/DEFAULT_FORWARD_POLICY="ACCEPT"/g' /etc/default/ufw
ufw reload
@rochacon
rochacon / dockerrun.aws.json
Created May 16, 2014 08:01
Deploy s3stub to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "rochacon/s3stub"
},
"Ports": [
{"ContainerPort": "80"}
]
}
@rochacon
rochacon / update-hook.sh
Created May 10, 2014 17:49
Simple gitreceive-next hook to build and run a slug with Flynn
#!/bin/bash
#
# Simple gitreceive-next hook to build and run a slug with Flynn
#
# This is an old script that I found sitting in my Desktop =P
#
# Last update: 2014-01-28
#
set -e
@rochacon
rochacon / trello_status.py
Created April 14, 2014 14:59
Simple script to extract card status and metrics from Trello
# -*- coding: utf-8 -*-
# Simple script to extract card info out of Trello
#
# ATTENTION: THIS IS TOO INCOMPLETE, but may be a base for something useful
#
# TODO: count points
# TODO: extra: count "blocks" per card
#
from multiprocessing import Pool
@rochacon
rochacon / clean_celery_backend_cleanup_task.py
Created April 5, 2014 03:04
Simple script to consume every "celery.backend_cleanup" task from a queue
# -*- coding: utf-8 -*-
"""
This script cleans up celery.backend_cleanup task from a queue.
Different tasks will be printed and returned to the queue
"""
import kombu
AMQP_ENDPOINT = 'amqp://guest:guest@localhost:5672/vhost'
AMQP_QUEUE = 'celery'
@rochacon
rochacon / dumper.go
Last active April 12, 2018 12:40
Simple HTTP request dumper
// dumper is a simple HTTP server that dumps requests to stdout
// useful for debugging HTTP clients
package main
import (
"bytes"
"flag"
"io"
"io/ioutil"
@rochacon
rochacon / shortener.py
Last active August 29, 2015 13:56
Simple URL shortener built with Pyramid (just for fun)
# -*- coding: utf-8 -*-
"""
Simple URL shortener built with Pyramid.
# Setup
## Dependencies
* pyramid>=1.5a3
* sqlalchemy>=0.9
* pyramid_tm
@rochacon
rochacon / bootstrap.sh
Last active January 2, 2016 16:09
Simple flynn/gitreceiver-next receiver script to build and run a slug
#!/bin/bash
# This script will setup your server from scratch
set -e
# Setup Docker
curl -sL http://get.docker.io/ | bash
docker pull flynn/slugbuilder
docker pull flynn/slugrunner