Skip to content

Instantly share code, notes, and snippets.

View epleterte's full-sized avatar

Christian Bryn epleterte

  • I am on the Internet
View GitHub Profile
@epleterte
epleterte / .tmux.conf
Created May 25, 2012 07:51 — forked from aaronjensen/.tmux.conf
robust tmux zoom toggle
# zoom
unbind ^M
bind ^M new-window -d -n zoom 'tmux-zoom'
@epleterte
epleterte / role.rb
Created September 17, 2012 23:07 — forked from tommybotten/role.rb
Example fact to determine the role of a server
# Fact: role
#
# Purpose:
# Return the installed and running applications on the system.
#
# FIXME: Add amq, varnish,
# FIXME: As of now, interpreting/matching text and not return codes :(
Facter.add(:role) do
setcode do
@epleterte
epleterte / rackup.sh
Created October 4, 2012 16:51
Better, untested rackup
#!/bin/bash -ue
/usr/bin/curl -s -k -F userfile=@<( /usr/bin/facter ) -u user:pass "https://racktables/index.php?page=depot&tab=facter&op=Update" > /dev/null 2>&1
@epleterte
epleterte / catalina.logrotate
Created October 12, 2012 13:54
Logrotate, catalina.out
# logrotate suggestion for catalina
/apps/tomcat/*/logs/catalina.out {
copytruncate
daily
rotate 5
compress
notifempty
missingok
size 100M
}
@epleterte
epleterte / gist:4341982
Last active December 9, 2015 23:08
resize logical volumes in volume groups on multipath devices only works with one logical volume per volume group
#!/bin/bash -ue
function list_paths() {
multipath -ll -v 1
}
function print_usage() {
cat <<EOF
Multipath device resizer
Resize multipath device if one LV in one VG on a multipath device PV
@epleterte
epleterte / gist:4634149
Last active December 11, 2015 17:28
postgresql-backup
#!/bin/bash -ue
# Postgres backup script
# Christian Bryn
backup_mountpoint="/var/nfs-backup"
backup_path="${backup_mountpoint}/${HOSTNAME}/postgresql"
[ ! -d "${backup_path}" ] && mkdir -p "${backup_path}"
#backup_timestamp=$( date '+%d' )
@epleterte
epleterte / mygrants.sh
Created March 19, 2013 14:30
mygrants!
# cool mysql grants printing function (producing proper sql) - http://serverfault.com/a/13050
# example:
# mygrants --host=prod-db1 --user=admin --password=secret | grep rails_admin | mysql --host=staging-db1 --user=admin --password=secret
mygrants()
{
@epleterte
epleterte / wildpingpong.sh
Last active December 18, 2015 02:59
Wild asian ping pong in the wild
#!/bin/bash -ue
# ANIMATE them wild asian ping pong players
# chr.bryn@gmail.com
# Q( - _-)_____¦___o__Q(-_ - )
court_length=12
speed="0.3"
colors="false"
clear="false"
@epleterte
epleterte / lbwatch
Last active December 23, 2015 13:19
nginx upstream status in your terminal...
#!/bin/bash -ue
domain="customer.com"
environment=$( facter -p customer_env )
proto="http"
lb_host="web1.${environment}.${domain}"
## uri of exposed nginx upstream status with format csv
nginx_upstream_uri="/lb?format=csv"
interval=1
@epleterte
epleterte / buttons.py
Created December 20, 2013 01:13 — forked from larsks/buttons.py
#!/usr/bin/python
import pifacecommon.core
import pifacecommon.interrupts
import os
import time
quit = False
def print_flag(event):