Skip to content

Instantly share code, notes, and snippets.

View deckerego's full-sized avatar

John Ellis deckerego

View GitHub Profile
@deckerego
deckerego / Slack.py
Created May 7, 2015 17:16
Send your current IP address to Slack
import logging
import socket
from slacker import Slacker
from config import configuration
logger = logging.getLogger('slack')
class Slack(object):
def __init__(self, printer):
@deckerego
deckerego / remove_kernels.sh
Last active August 29, 2015 14:20
Remove unused kernel packages in Ubuntu
sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@deckerego
deckerego / interfaces
Created February 1, 2015 21:23
Raspberry Pi Wireless Config
auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
@deckerego
deckerego / stale_branches.sh
Last active August 29, 2015 14:12
Remove Stale Git Branches
# Find branches already merged
git branch -a --merged
# Find a list of branches by date and author
git for-each-ref --sort=committerdate --format='%(committerdate:short) %(authorname) %(refname:short)' | grep "origin"
# Prune your locally cloned version
git fetch -p
git gc --prune=now
git remote prune origin
@deckerego
deckerego / default_vhost
Created April 18, 2014 07:56
Apache mod_rewrite rule to redirect all traffic except PNGs
RewriteEngine on
RewriteCond %{REQUEST_URI} !^.*\.png
RewriteRule ^/(.+) /index.html
@deckerego
deckerego / aws_status.py
Created December 6, 2013 22:18
Look at the US-EAST-1 RSS feeds for AWS and see if there are any outages
#!/usr/bin/python
import feedparser
import time
rss_feeds = {
"http://status.aws.amazon.com/rss/elb-us-east-1.rss",
"http://status.aws.amazon.com/rss/ec2-us-east-1.rss",
"http://status.aws.amazon.com/rss/elasticache-us-east-1.rss",
"http://status.aws.amazon.com/rss/rds-us-east-1.rss",
@deckerego
deckerego / etc_cron.daily_backup
Last active December 4, 2019 16:07
Use the disk archiver (DAR) to perform a full backup every other month, otherwise create an incremental backup.
#!/bin/bash
source /etc/default/backup
MONTH_TWO=$(date -d "- 2 month" '+%Y-%m')
MONTH_PREV=$(date -d "- 1 month" '+%Y-%m')
MONTH_NOW=$(date '+%Y-%m')
DATE=`date +%Y-%m-%d`
HOST=`hostname`
@deckerego
deckerego / create_branches.sh
Created December 6, 2013 22:17
Mass-create branches in multiple Git repos and push them remote
#!/bin/sh
PROJECTS="Project_1 Project_2 Project_3"
BRANCH="$1"
if [[ -z "$BRANCH" ]]; then
echo "Usage $0 BRANCH_NAME"
exit -1
fi
@deckerego
deckerego / DeckerInfo.theme
Created December 6, 2013 22:16
SuperKaramba system display initially based on revolutionist's "all system info engl. v." from http://www.kde-look.org/content/show.php?content=33202
karamba x=100 y=210 w=220 h=900 interval=1000 locked=true
defaultfont color=255,255,255 fontsize=9 font="DejaVu Sans" shadow=1 bgcolor=0,0,0
# time
text x=55 y=0 sensor=time format="ddd, MMM d yyyy" fontsize=12
text x=45 y=15 sensor=time format="hh:mm" font="DejaVu Sans Mono" fontsize=48
text x=65 y=70 sensor=uptime format="Up %dd %Hh:%Mm" fontsize=12
# proc
image x=95 y=80 path="/usr/share/icons/oxygen/48x48/devices/cpu.png"
@deckerego
deckerego / dropbox
Created December 6, 2013 22:16
Dropbox startup script for automated installations
#!/bin/bash
#
# ------------------------------------------------------
# Dropbox Startup Script for Unix
# ------------------------------------------------------
# dropbox This shell script takes care of the Dropbox server instance
#
# chkconfig: 2345 80 30
# description: dropbox is liquid awesome
# processname: java