Skip to content

Instantly share code, notes, and snippets.

View andrewsmedina's full-sized avatar

Andrews Medina andrewsmedina

View GitHub Profile

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

Dual-booting Ubuntu alongside OS X on your MacBook Pro

dual_boot!

Why do this?

  1. To run a broader array of software than with OS X alone.
  2. To run faster, by more fully exploiting the hardware, and by running with a smaller memory footprint.
  3. To more fully customize the user interface.
from south.modelsinspector import add_introspection_rules
from django.db import models
from django.db.models import permalink
from django.contrib.auth.models import User
from core.models import Cliente
from biblioteca.models import Imagem
from base64 import b32encode
from hashlib import sha1
from random import random
#!/bin/bash -u
docker="docker -H 127.0.0.1:4243"
if [ $# -lt 2 ]
then
echo >&2 "ERROR: wrong number of parameters."
echo >&2
echo >&2 "Usage:"
echo >&2 " $0 <image> <path_on_container::url> [path_on_conainer:url] ..."
#!/bin/bash
PREFIX=registry.cloud.tsuru.io/tsuru/
read command
for image in "$@"
do
echo "Generating $image... "
full_image=${PREFIX}${image}
id=`docker -H 127.0.0.1:4243 run -d $full_image $command`
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from nacho.services.servers import NachoServer
from nacho.services.routers import Routers
from nacho.controllers.base import ApplicationController
from tornado.escape import json_encode
class MainHandler(ApplicationController):
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
- 2 runs, one warmup, one timed
- warmup was 5m
- timed run 30s
- default sentry settings (no database access)
- 3 sync workers
- sentry start
- os-x (brew install pypy --devel)
- siege -c 3 http://localhost:9000/login/ -b -t30S
== pypy 2.0 beta 2
from splinter import Browser
from tempfile import NamedTemporaryFile
data = """
<html><head><title>Splinter testing</title></head><body>
<select id="estado" name="estado">
<option value="teste1">teste1</option>
<option value="teste2">teste2</option>
<option value="teste3">teste3</option>
<option value="teste4">teste4</option>
"Logistic map iteration timing"
from itertools import islice
import time
import main
def logistic_map(r, x):
assert r > 0, 'R must be a positive number'
assert 0 < x < 1, 'X must be a number between 0 and 1'
while True: