Navigation Menu

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 / sudovim.sh
Created June 20, 2017 22:52
I sometimes forget to sudo my vim
#!/bin/bash -ue
# Christian Bryn <chr.bryn@gmail.com> 2016
# License: WTFPL
# Easy-to-use wrapper for sudo that helps you remember to launch vim with sudo when needed
# Stick this in ~/bin/
# autodetection of editor:
#cmd=$( which $EDITOR )
#...does not work as soon as this file is in path, right...if it's called the same as EDITOR, of course ('vim')
#!/bin/bash -ue
# Christian "Superstar" Bryn <chr.bryn@gmail.com> 1850-2017
function print_usage {
cat <<EOF
Usage: ${0} [-h|-a|-b|-q] <branch1> [<branch2>]
-h Print usage
-a All - automatically check all branches and delete if merged.
-b Batch - skip 'destructive action' warning.
-q Quiet - turn off verbosity.
@epleterte
epleterte / mysql_rep.sh
Created November 4, 2015 09:22 — forked from onecooltaco/mysql_rep.sh
A mysql replication plugin for the check_mk nagios system
#!/bin/bash
#
# A mysql replication plugin for the check_mk nagios system.
# Place me in /usr/lib/check_mk_agent/local on the client
#
# Hereward Cooper <coops@iomart.com> - 16/06/11
MYSQL_USER="root"
MYSQL_PASS="PAassw0rd"
// ==UserScript==
// @name watchcartoononline
// @description Description
// @author Chris H (Zren / Shade)
// @icon http://xshade.ca/favicon.ico
// @namespace http://xshade.ca
// @version 1
// @grant none
// @include http://www.watchcartoononline.com/*
// @include http://www.animeuploads.com/embed.php*
@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):
@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 / 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 / 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 / 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 / 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