Skip to content

Instantly share code, notes, and snippets.

@metalivedev
metalivedev / keybase.md
Last active November 12, 2015 00:43
Proof of my identity. Here I am metalivedev. On keybase.io I am rufus.

Keybase proof

I hereby claim:

  • I am metalivedev on github.
  • I am rufus (https://keybase.io/rufus) on keybase.
  • I have a public key whose fingerprint is E398 6BAC 410D 21B7 CC46 9155 66B0 2926 00B1 B9FE

To claim this, I am signing this object:

@metalivedev
metalivedev / rmvol.py
Last active August 29, 2015 14:26
Tool to remove unused volumes
#!/usr/bin/env python
"""
Check all existing Docker containers for their mapped paths, and then purge any
zombie directories in docker's volumes directory which don't correspond to an
existing container.
FROM https://github.com/docker/docker/issues/6354#issuecomment-114688663
Modified by metalivedev to work with Docker 1.6.x
"""
import logging
import os
@metalivedev
metalivedev / gist:ce45d4278410807a91e3
Last active August 29, 2015 14:01 — forked from samalba/gist:5400413
Clean up hung kworkers, usually caused by some container
echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event
cat /sys/kernel/debug/tracing/trace_pipe > out.txt
# (Leave it running a couple of seconds, then Ctrl+C; this is just to flush the buffer)
# Do it again to get fresh info
cat /sys/kernel/debug/tracing/trace_pipe > out.txt
(Leave it running a couple of seconds, then Ctrl+C; this is to recover the data)
cut -d- -f2 out.txt | awk '{print $1}' | sort | uniq -c | sort -n
# Take a look at who's got the most instructions queued (first column) and kill them and their children
# Sam dumped something out of the cgroup to get the process list and ran xargs kill -9
$ curl -v -I https://dashboard.dotcloud.com
* About to connect() to dashboard.dotcloud.com port 443 (#0)
* Trying 184.73.159.228... connected
* Connected to dashboard.dotcloud.com (184.73.159.228) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
"""
Exports Issues from a specified repository to a CSV file
Uses basic authentication (Github username + password) to retrieve Issues
from a repository that username has access to. Supports Github API v3.
"""
import csv
import requests
@metalivedev
metalivedev / macosxerror.txt
Last active August 29, 2015 13:56
Error on trivial Mac OS X / docker/ boot2docker interaction.
mac$ VirtualBox -?
Oracle VM VirtualBox Manager 4.3.6
(C) 2005-2013 Oracle Corporation
...
mac$ cd src/boot2docker/
mac$ ./boot2docker init
mac$ ./boot2docker up
mac$ export DOCKER_HOST=tcp://
mac$ ./docker version
@metalivedev
metalivedev / Dockerfile-RTD
Last active January 2, 2016 04:39
Containerizing RTD. Requires 1GB of RAM to compile in a VM. This version does all the apt-get's in one layer and sets up the database. You'll still need to use ./manage.py updatepassword manually -- haven't figured out how to automate that yet.
FROM ubuntu
# Add the Universe to the repo list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise universe' >> /etc/apt/sources.list
RUN echo 'deb http://us.archive.ubuntu.com/ubuntu/ precise-updates universe' >> /etc/apt/sources.list
# You might also need redis, nginx, postgres, and celeryd to work like production RTD.
# openssh-server is optional and just makes it easier to interact with the container later.
RUN apt-get update && apt-get install -y gcc git openssh-server python-pip python-dev libxml2-dev libxslt1-dev
RUN git clone http://github.com/rtfd/readthedocs.org.git
RUN cd readthedocs.org && pip install -r pip_requirements.txt
@metalivedev
metalivedev / docprs.py
Last active December 28, 2015 09:19
Quick hack to check the Docker project pull requests for requests that have docs in them. This lists them and sets the label to "doc" so I can later find them easily in the github UI. Also makes a nice list of the docs being modified so I can check them for conflicts.
import requests
import json
mytoken = 'SECRET_PERSONAL_TOKEN_SEE:https://github.com/settings/applications'
url = 'https://api.github.com/repos/dotcloud/docker'
addlabels = {}
labelarray = [ '/project/doc' ] #start with the docs label, and then any others for code
addlabels['docs'] = json.dumps( labelarray )
# We're not going to add a second lable for code anymore
# since the core team will be watching all PRs.
@metalivedev
metalivedev / 2007-hostint.diff
Created October 9, 2013 02:45
fix up host_integration.rst
diff --git a/docs/sources/use/host_integration.rst b/docs/sources/use/host_integration.rst
index cc2f56a..47d9ea7 100644
--- a/docs/sources/use/host_integration.rst
+++ b/docs/sources/use/host_integration.rst
@@ -2,67 +2,124 @@
:description: How to generate scripts for upstart, systemd, etc.
:keywords: systemd, upstart, supervisor, docker, documentation, host integration
+
+
@metalivedev
metalivedev / gist:6085112
Created July 26, 2013 00:33
42 Layer Limit to AUFS using "base" image
Sample Dockerfile, then sample build output
#--------------
FROM base
RUN echo Layer 0 >> layerfile.txt
RUN echo Layer 1 >> layerfile.txt
RUN echo Layer 2 >> layerfile.txt
RUN echo Layer 3 >> layerfile.txt
RUN echo Layer 4 >> layerfile.txt