There is a surprising lack of documentation on how to do this. See:
- http://dst.lbl.gov/~boverhof/openssl_certs.html
- etcd-io/etcd#209
- https://www.prshanmu.com/2009/03/generating-ssl-certificates-with-x509v3-extensions.html
Run:
#!/usr/bin/env python | |
# Check whether a file contains valid UTF-8 | |
# From http://stackoverflow.com/a/3269323 | |
import codecs | |
import sys | |
import os | |
def checkFile(filename): | |
try: |
# Create a simple HTML visualisation of similarity scores between last.fm users. | |
# Replace API_KEY with your Last.fm api key, and USERS_* with a list of usernames. | |
import sys | |
import time | |
import urllib2 | |
import xml.dom.minidom | |
api_key = API_KEY |
#!/usr/bin/env python | |
# Prints out a tree of processes with cpu and memory use | |
# Usage: process-tree-monitor pid [-v] | |
import psutil | |
from datetime import datetime | |
import sys | |
import time |
#!/usr/bin/env python | |
import math | |
import os | |
import psutil | |
import sys | |
import time | |
try: | |
import termcolor | |
TERMCOLORS = termcolor.COLORS.keys() |
DROP TABLE IF EXISTS test_edges; | |
DROP TABLE IF EXISTS test_nodes; | |
CREATE TABLE test_nodes(id SERIAL PRIMARY KEY); | |
CREATE TABLE test_edges( | |
a INTEGER REFERENCES test_nodes(id), b INTEGER REFERENCES test_nodes(id)); | |
INSERT INTO test_nodes(id) VALUES (0); | |
-- Create a graph with 100,000 nodes |
There is a surprising lack of documentation on how to do this. See:
Run:
A very simple polling agent that updates an Etcd database with SkyDNS entries for all OpenStack instances in a tenancy.
Example
docker run -d --name etcd quay.io/coreos/etcd \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 --debug
#!/bin/bash | |
# Requires pg_stat_statements extension on the server | |
# https://www.postgresql.org/docs/9.6/static/pgstatstatements.html | |
if [ $# -ne 1 ]; then | |
echo Usage: $(basename "$0") dbname | |
exit 1 | |
fi | |
sudo -u postgres psql "$1" -c ' |
Setup a single node Kubernetes cluster for development using kubeadm: https://kubernetes.io/docs/setup/independent/install-kubeadm/
Create a CentOS 7 or Ubuntu Xenial (16.04) machine, and run kubeadm.sh
as root
.
You can pass this script as user-data to cloud-init so that it will be automatically run. For example, on openstack:
openstack server create NAME --flavor FLAVOR --key-name KEY --image 'Ubuntu Xenial' --network NET --security-group SECGROUP --user-data kubeadm.sh
#!/usr/bin/env python | |
# Convert the output of `lsof -F` into PID USER CMD OBJ | |
import sys | |
rs = [] | |
pid = -1 | |
cmd = '' | |
user = '' | |
for line in sys.stdin: |