Skip to content

Instantly share code, notes, and snippets.

@elementalvoid
elementalvoid / postgresql-with-replication-collectd.conf
Last active November 24, 2015 19:34
minimal collectd conf for postgres
LoadPlugin postgresql
<Plugin postgresql>
<Query bgwriter>
Statement "SELECT checkpoints_timed, checkpoints_req, \
buffers_checkpoint, buffers_clean, maxwritten_clean, \
buffers_backend, buffers_alloc \
FROM pg_stat_bgwriter"
<Result>
@elementalvoid
elementalvoid / example.py
Last active August 29, 2015 14:02
docker-py volume binding failure
import docker
client = docker.Client(base_url='unix://var/run/docker.sock', version='1.11', timeout=10)
client.pull('busybox', tag='latest')
container = client.create_container('busybox:latest', volumes=['/var/run/docker.sock'])
# This fails. It's based on https://github.com/dotcloud/docker-py#using-volumes
client.start(container, binds={'/var/run/docker.sock': {'bind': '/var/run/docker.sock', 'ro': False}})
@elementalvoid
elementalvoid / keybase.md
Last active February 18, 2018 19:22
keybase.io proof for ElementalVoid

Keybase proof

I hereby claim:

  • I am elementalvoid on github.
  • I am elementalvoid (https://keybase.io/elementalvoid) on keybase.
  • I have a public key ASAC5MizJD7H1vf37_WZkXoe2wiloQqQvqy_0flxnGjmdwo To claim this, I am signing this object:
{
  "body": {
    "key": {
#!/bin/bash
if (( $# != 3 )); then
echo "Usage: $(basename $0) <username> <db-host> <db-name>"
exit 1
fi
PSQL_USER=${1}
PSQL_HOST=${2}
PSQL_DB=${3}
1 11 11 111
00000000100001 100000 1000001 0001 0
1 0011 00 11101 0011100 0011100 11 0 0
0 10 01 0 101 0 101 101 0
01 00 101 01 101 01 101 01 0
01 00 101 01 101 01 101 101 10
01 00 101 01 101 01 10 101 00
101 00 101 01 101 01 101 101 100
01 00 101 01 101 01 101 101 1101
101 00 101 01 101 01 10 1011001 01
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
#!/usr/bin/env python
import sys
import time
import signal
from optparse import OptionParser
from multiprocessing import Pool
from subprocess import Popen, PIPE
class TimeoutException(Exception):
pass
#!/bin/bash
set -o nounset
##########################################
# Defaults
##########################################
: ${recipient:=}
: ${host:=localhost}
: ${port:=5432}
: ${databases:=}
@elementalvoid
elementalvoid / firesocks
Created December 1, 2015 16:22
Run firefox configured for a SSH Socks proxy connection that's managed by the script.
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "usage: $(basename ${0}) <gateway>"
exit 1
fi
gateway=${1}
shift
#!/usr/bin/env python
import argparse
import re
from os import walk
from os.path import join
def get_patterns(patterns_dir):
patterns = {}