Skip to content

Instantly share code, notes, and snippets.

View rochacon's full-sized avatar

Rodrigo Chacon rochacon

  • Remote
  • 12:21 (UTC -03:00)
View GitHub Profile
@rochacon
rochacon / mesos-cloud-init.sh
Created January 16, 2015 20:54
This is a simple cloud-init script to install Mesos and Marathon in a Ubuntu machine.
#!/bin/bash -eux
#
# This is a simple cloud-init script to install Mesos and Marathon in a Ubuntu machine.
#
# AWS cli usage:
# aws ec2 run-instances --image-id ami-4ae27e22 --key-name my-key --instance-type m3.medium --subnet-id "subnet-00000000" --associate-public-ip-address --user-data "$(cat user-data.sh)" --region us-east-1
#
# Install Docker
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
package main
import (
"fmt"
"github.com/go-redis/redis"
)
func main() {
cli := redis.NewTCPClient(&redis.Options{
Addr: "127.0.0.1:6379",
@rochacon
rochacon / host-ip-to-route53.py
Last active August 29, 2015 14:11
Simple script to set DNS for local IP
#!/usr/bin/env python
#
# This is a simple script to set the local IP to an Route53 zone
#
# Dependencies:
# pip install boto netifaces
#
# Usage:
# host-ip-to-route53.py wlan1 machine1.domain.net
#
@rochacon
rochacon / cmd-to-websocket.go
Created December 8, 2014 20:17
Stream a command stderr and stdout throught websockets
package main
import (
"bufio"
"fmt"
"github.com/gorilla/websocket"
"io"
"log"
"net/http"
"os/exec"
@rochacon
rochacon / list-app-processes.go
Created October 20, 2014 05:28
Simple script to list Procfile entries from a tar stream
//
// Read and parse an Procfile of a tar stream from stdin
//
// example: git archive HEAD | list-app-processes
//
//
package main
import (
"archive/tar"
@rochacon
rochacon / models.py
Last active August 29, 2015 14:06
A different approach to Django view unit testing
from django.db import models
class Twt(models.Model):
txt = models.CharField(max_length=140)
@rochacon
rochacon / Dockerrun.aws.json
Created September 3, 2014 19:07
AWS Beanstalk Python web app on Docker
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Update": "false"
},
"Ports": [
{"ContainerPort": "8080"}
],
}
@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;
@rochacon
rochacon / after-patch.log
Last active April 25, 2017 21:43
Docker issue 5684
ubuntu@ip-10-13-0-67:~$ bash -xe test.sh
+ docker version
Client version: 1.1.1
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): bd609d2
Server version: 1.1.1
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): bd609d2
@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"