Skip to content

Instantly share code, notes, and snippets.

View codatory's full-sized avatar

Alex Conner codatory

View GitHub Profile
#!/bin/bash
# Mac Bootstrap Script
# (C) 2011 - @codatory
#
# "It might work for you, too."
pretty_echo(){
echo '--------------------------------'
echo " $*"
# Configuration Constants (move to yaml ?)
HOST = 'ad01.domain.local'
PORT = 636
USER = 'administrator'
PASS = 'password'
BASE = 'dc=domain, dc=local'
DOMAIN = 'domain.local'
SCOPE = '(&(objectCategory=person)(objectClass=user))'
require 'rubygems'
class ExifData
require 'celluloid'
def initialize(file)
raise 'Expects Upload!' unless file.is_a?(Upload)
@upload = file
end
def process!
# this is fictitional
CURRENT=`pwd`
mkdir /tmp/repo_archive
cd /tmp/repo_archive
git clone --quiet --bare "$CURRENT" repository
tar -c repository | pigz --best > "$CURRENT/archive.tar.gz"
cd $CURRENT
rm -rf /tmp/repo_archive
@codatory
codatory / init.el
Created February 6, 2012 14:56
My emacs init.el
;; emacs configuration
(push "/usr/local/bin" exec-path)
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
(setq tramp-default-method "scpx")
# c = CSVBuilder.new ['column 1 name', 'column 2 name', 'column 3 name']
# rowdata.each do |r|
# special_column = r.boolean ? 'YES' : 'NO'
# c.add_row [special_column, r.name, r.date]
# end
# c.export('optional_filename.csv')
class CSVBuilder
def initialize(head)
if head.is_a?(Array)
@codatory
codatory / check_update.sh
Created February 27, 2012 20:16
CentOS / Fedora Weekly update checking script
#!/bin/bash
UPDATES=`yum check-update -q | awk '{print $1}'`
COUNT=`printf "%s\n" "$UPDATES" | grep -v "^$" | wc -l`
YUM=`printf "%s\n" "$UPDATES" | grep -v "^$" | grep yum`
echo '--------------------------------------------------------------------------------'
echo " Weekly Update Notification for `hostname`"
echo " -> $COUNT update(s) available"
if [ -n "$YUM" ]; then
echo ' -> IMPORTANT: A Yum update is available. Perform this separately and first.'
fi
@codatory
codatory / check_update.sh
Created February 27, 2012 20:44
Debian / Ubuntu Check update script
#!/bin/bash
apt-get update -qq
UPDATES=`apt-get dist-upgrade --simulate | grep Inst | awk '{print $2}'`
COUNT=`printf "%s\n" "$UPDATES" | grep -v "^$" | wc -l`
echo '--------------------------------------------------------------------------------'
echo " Weekly Update Notification for `hostname`"
echo " -> $COUNT update(s) available"
echo '--------------------------------------------------------------------------------'
printf "%s\n" "$UPDATES"
@codatory
codatory / updates.sh
Created March 1, 2012 16:02
Automatically run the current latest check_update script
#!/bin/bash
YUM=`which yum 2> /dev/null`
APT=`which apt-get 2> /dev/null`
YUM_GIST=1926743
APT_GIST=1926909
if [ $YUM ]; then
bash < <(curl --location --silent https://raw.github.com/gist/$YUM_GIST)
@codatory
codatory / .tmux.conf
Created April 6, 2012 19:15
TMUX Conf
# Switch me back to ^A, thanks
set-option -g prefix C-a
unbind-key C-b
bind-key a send-prefix
# I miss ^A^A and ^ASpace
bind-key C-a last-window
bind-key Space next-window
bind-key C-Space previous-window