Skip to content

Instantly share code, notes, and snippets.

View rochacon's full-sized avatar

Rodrigo Chacon rochacon

  • Remote
  • 13:07 (UTC -03:00)
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / md-server.go
Created July 24, 2014 21:18
Simple web server to render Markdown from a folder
// md-server is a simple web server to render Markdown files through HTTP
// this was just a quick "hack" so I could show some docs I was working on to a friend
// since the lack of styles and links, this ended up being completely unuseful
// if you want a serious Markdown renderer server, take a look at: http://www.mkdocs.org/
package main
import (
"flag"
"fmt"
"github.com/russross/blackfriday"
@rochacon
rochacon / nginx.conf
Created August 31, 2014 22:41
Simple NGINX conf that I use inside Docker containers for testing
daemon off;
worker_processes 1;
events {
worker_connections 1024;
}
http {
access_log /dev/stdout;
error_log /dev/stdout info;