Skip to content

Instantly share code, notes, and snippets.

input {
syslog {
type => syslog
port => 514
}
tcp {
type => "apache-access"
port => 9514
}
@ubergarm
ubergarm / gist:7ff6e6af0afa4bf2def7
Created May 27, 2014 19:36
Docker Private Registry HTTP code 301 while uploading metadata
Docker Daemon logs for two failed attempts pushing to private registry. The 3rd push seems to be working so far.
@400000005384d7371398bf1c [c7612ee1] +job allocate_interface(8a7da707411b8d77be142606d0b558792cbbec61b511ac395db5f318832b9265)
@400000005384d737139ae5e4 [debug] attach.go:59 attach: stdout: begin
@400000005384d737139b9994 [debug] attach.go:97 attach: stderr: begin
@400000005384d737139c030c [debug] attach.go:143 attach: waiting for job 1/2
@400000005384d737139e2dbc [c7612ee1] -job allocate_interface(8a7da707411b8d77be142606d0b558792cbbec61b511ac395db5f318832b9265) = OK (0)
@400000005384d73b2145a594 [c7612ee1] +job release_interface(8a7da707411b8d77be142606d0b558792cbbec61b511ac395db5f318832b9265)
@400000005384d73b21466114 [c7612ee1] -job release_interface(8a7da707411b8d77be142606d0b558792cbbec61b511ac395db5f318832b9265) = OK (0)
@400000005384d73b21489394 [debug] attach.go:76 attach: stdout: end
@ubergarm
ubergarm / nginx.conf.md
Created June 4, 2014 20:44
Dynamic Proxy nginx.conf

A top level redirect can be updated to point to the latest git ref Docker container.

location = / {
    rewrite ^/(.*) /abc1234/$1 redirect;
}

location ~ "^/([0-9a-zA-Z]{7})/.*$" {                                          
    set $target $1.myimage.dev.docker:5000;
    auth_basic off;

proxy_pass http://$target;

@ubergarm
ubergarm / docker-nsinit-howto.md
Last active January 11, 2016 16:17
How to compile nsinit for Docker to access a shell in a running container.

Docker nsinit

nsinit provides a handy way to access a shell inside a running container's namespace. This is useful for learning about how containers work, debugging your system without worrying about sshd daemons, and even hot fixes in production all you sad pandas!

:p

Running the docker daemon with the lxc driver allows you to use lxc-attach to do this. But now that docker deafults to the new native libcontainer driver, nsinit is probably the best way to go. jpetazzo's blog has a great high level summary.

The new issue is that the libcontainer .json format is under heavy development so you need to keep an nsinit binary built from the exact release tag from the the docker github repo. The tricky part for me was understanding that golang is designed with certain assumptions about dependencies vs versioning with regards to when you push to master, push to a topic branch, and fork a project.

@ubergarm
ubergarm / DwarfTherapist-backtrace.md
Created November 27, 2016 17:27
DwarfTherapist 64bit Linux testing
@ubergarm
ubergarm / async-client.py
Last active January 5, 2017 20:59
Python 3.5+ Async I/O Web Requests
#!/usr/bin/env python3
## Run
# docker run --rm -it -v `pwd`:/app -w /app python:3.5.2-slim /bin/bash
# pip install aiohttp uvloop
# python async-client.py
## References
# http://aiohttp.readthedocs.io/en/stable/
# https://github.com/MagicStack/uvloop
/*
Minimal HTTP Response Server Test
Modified from [sustrik/dsock/tutorial/step3.c]
Test with `wrk -t2 -c100 -d30s localhost:5555`
Copyright (c) 2016 Martin Sustrik
Copyright (c) 2017 John W. Leimgruber III
Permission is hereby granted, free of charge, to any person obtaining a copy
@ubergarm
ubergarm / rake.py
Last active March 4, 2017 21:31
CLI Text Phrase Extraction using RAKE
#!/usr/bin/env python3
# Example Usage:
# $ curl -s https://sherlock-holm.es/stories/plain-text/croo.txt | ./rake.py --limit=10 --minscore=5
# Download SmartStopList.txt from:
# https://github.com/fabianvf/python-rake
import sys
import RAKE
import argparse
# Accept input from stdin or filename
@ubergarm
ubergarm / adult-swim-chat.ipynb
Created April 5, 2018 21:25
Adult Swim Chat ANALyzer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ubergarm
ubergarm / do-docker-0.90.md
Created March 21, 2014 20:21
DigitalOcean Docker 0.90 w/ cgroups and memory limits working.

DigitalOcean Latest Docker

Spin up a new droplet using stock Ubuntu 12.04.3 LTS

Rough Guide that would make a nice Ansible role:

# update kernel saucy 3.11.0-18-generic
$ apt-get update

$ apt-get purge linux-image-*