Skip to content

Instantly share code, notes, and snippets.

Avatar
🐢
rolling along

Nathan Williams nathwill

🐢
rolling along
View GitHub Profile
@nathwill
nathwill / random-walk.rb
Created Feb 7, 2021
example random walk routine
View random-walk.rb
#!/usr/bin/env ruby
#
class Rundganger
attr_accessor :coordinates, :path
def initialize
@coordinates = [0,0,0]
@path = [] << @coordinates.clone
end
@nathwill
nathwill / kibana-oauth2-proxy-ingress.yaml
Last active Mar 7, 2019
kubernetes ingress-nginx ingress for redirect/whitelist of access to AWS elasticsearch kibana behind oauth2-proxy
View kibana-oauth2-proxy-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: kibana-doorman
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/server-snippet: |
location = / { return 308 https://$best_http_host/_plugin/kibana; }
spec:
@nathwill
nathwill / gluster-test.yml
Created Oct 2, 2017
k8s external gluster
View gluster-test.yml
---
kind: Endpoints
apiVersion: v1
metadata:
name: glusterfs-cluster
subsets:
- addresses:
- ip: 10.138.0.8
ports:
- port: 49152
@nathwill
nathwill / create-cinder-snapshot.rb
Created Sep 12, 2016
simple snapshotting script
View create-cinder-snapshot.rb
#!/opt/chef/embedded/bin/ruby
#
# Create/manage Cinder volume snapshots
#
require 'mixlib/shellout'
require 'fog/openstack'
#
View alooma_restream_check.py
#!/usr/bin/env python
from sensu_plugin import SensuPluginCheck
import alooma
class AloomaRestreamCheck(SensuPluginCheck):
def setup(self):
self.parser.add_argument(
'-w',
'--warning',
@nathwill
nathwill / ha-redis-keepalived.conf
Created Apr 18, 2016
keepalived configuration for tracking redis master
View ha-redis-keepalived.conf
vrrp_script chk_redis_master {
script "redis-cli info replication | grep -q 'role:master'"
interval 2
weight 2
rise 2
fall 2
}
vrrp_instance redis_vip {
interface eth0
@nathwill
nathwill / openstack-heat-redis-ha.yaml
Last active Apr 18, 2016
heat template for an HA redis cluster
View openstack-heat-redis-ha.yaml
heat_template_version: 2015-04-30
description: set up the redis cluster
parameters:
default_image:
type: string
label: default base image
description: glance image id of the base image
default: centos-7.2
@nathwill
nathwill / pulse.txt
Last active Nov 28, 2017
heka monitoring
View pulse.txt
# heka.toml
[hekad]
base_dir = '/tmp/heka'
[boot]
type = "LogstreamerInput"
log_directory = '/var/log'
file_match = 'boot\.log'
[pulse]
@nathwill
nathwill / systemd-nspawn containers on centos
Last active Oct 1, 2019
super lightweight containers with systemd-nspawn
View systemd-nspawn containers on centos
assumes centos 7 host, typical configuration
- disable selinux: SELINUX=permissive in /etc/sysconfig/selinux
- disable auditd: systemctl disable auditd.service
- enable journald persistence: `Storage=persistent` in /etc/systemd/journald.conf
- mkdir /var/lib/container
- yum -y --nogpg --releasever=7 --installroot=/var/lib/container/centos install systemd passwd yum vim-minimal openssh-server
- systemd-nspawn -D /var/lib/container/centos
- set root passwd, set ssh port (e.g. 2222)
- set up systemd-nspawn service:
@nathwill
nathwill / memcached-stats-decoder.lua
Last active Sep 1, 2015
heka memcached stats decoder
View memcached-stats-decoder.lua
local l = require 'lpeg'
l.locale(l)
local sp = l.space^1
local unreserved = l.alnum + l.S"/=-.,_~"
local name = l.C(unreserved^1)
local prefix = l.P"STAT "
local pair = prefix^-1 * l.Cg(name * sp * name) * sp
local grammar = l.Cf(l.Ct("") * pair^0, rawset)