View devserver.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
replacement runserver for django with asyncio support | |
""" | |
import errno | |
import os | |
import sys | |
import socket | |
import asyncio | |
import aiomonitor |
View build-ubuntu-rootfs.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
control_c() | |
# run if user hits control-c | |
{ | |
echo -en "\n*** Ouch! Exiting ***\n" | |
exit $? | |
} |
View redis_sentinel.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import logging | |
from django.conf import settings | |
from django.core.exceptions import ImproperlyConfigured | |
from redis.sentinel import Sentinel | |
from django_redis.client import DefaultClient |
View etcd centos init.d script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Startup script for etcd | |
# | |
# chkconfig: 2345 20 80 | |
# description: Starts and stops etcd | |
. /etc/init.d/functions | |
prog="etcd" | |
ETCD_BIN=$(which etcd 2> /dev/null) |
View pacman.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[options] | |
NoUpgrade = etc/passwd etc/group etc/shadow | |
NoUpgrade = etc/pacman.conf | |
NoExtract = usr/share/doc/* | |
NoExtract = usr/share/info/* | |
NoExtract = usr/share/man/* | |
NoExtract = usr/share/locale/[a-d,f-k,m-z]* | |
NoExtract = usr/share/locale/e[a-m,o-z]* | |
NoExtract = usr/share/locale/l[a-n,p-z]* | |
NoExtract = usr/share/locale/lo |
View create-smartos-vm.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Creates a SmartOS VM in VirtualBox (assuming you alread have VirtualBox installed) | |
# | |
# This script will: | |
# * Download the latest live ISO image of SmartOS | |
# * Create a VirtualBox VM, or update an existing VM with the latest ISO | |
# * Configure the VM with a zones disk, and boot it! | |
# | |
# |
View minimal-archlinux-for-docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TGZ=http://hkg.mirror.rackspace.com/archlinux/iso/2014.11.01/archlinux-bootstrap-2014.11.01-x86_64.tar.gz | |
ROOT=/var/lib/archlinux | |
TMPROOT=/tmp/archlinux | |
sudo mkdir -p ${TMPROOT} | |
wget "${TGZ}" -O- | sudo tar --strip-components=1 -C ${TMPROOT} -Pxzf- | |
sudo sed --in-place s/^#//g ${TMPROOT}/etc/pacman.d/mirrorlist | |
sudo btrfs subvolume delete ${ROOT} | |
sudo btrfs subvolume create ${ROOT} |
View squash-docker-save
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o pipefail | |
function list_tars { | |
ROOT=$1 | |
TAG=${2:-latest} | |
BASE=$(sed -e 's/.*{\(".*"\)}.*/\1/g' "${ROOT}/repositories" | sed 's/"//g' | awk -v RS=',' -F: '/^'${TAG}'/ {print $2}') | |
CUR=$BASE |
View tar-docker-image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker_root=/var/lib/docker/btrfs | |
subvolumes=subvolumes | |
docker_image=aputs/archlinux | |
tar_file=/tmp/image.tar.gz | |
# tar | |
cd $docker_root/$subvolumes/$(docker inspect --format='{{.Id}}' $docker_image) | |
tar --exclude={'.','..'} -Pcvzf $tar_file .* * |
View docker-lvm-arch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lvcreate --wipesignatures y -n thinpool arch -L 100G | |
lvcreate --wipesignatures y -n thinpoolmeta arch -L 1G | |
lvconvert -y --zero n -c 512K --thinpool arch/thinpool --poolmetadata arch/thinpoolmeta | |
cat <<EOF | tee /etc/lvm/profile/docker-thinpool.profile | |
activation { | |
thin_pool_autoextend_threshold=80 | |
thin_pool_autoextend_percent=20 | |
} |