Skip to content

Instantly share code, notes, and snippets.

View jeekl's full-sized avatar
💩

Jeff Eklund jeekl

💩
View GitHub Profile
@jeekl
jeekl / gist:3088192
Created July 11, 2012 05:35
problems setting up dotdeb mirror with reprepro
/srv/mirror# cat dotdeb/conf/distributions
origin: Dotdeb
Codename: dotdeb
Description: Dotdeb repository for Debian-based LAMP servers
Architectures: amd64 source
Components: all
Contents: .gz
Update: dotdeb
Log: dotdeb
# SignWith:
@jeekl
jeekl / gist:3917098
Created October 19, 2012 09:12
pre-commit hook, checking json syntax in groups/users for chef-repo
git stash -q --keep-index
for file in data_bags/user/* data_bags/group/* ; do
python -mjson.tool $file 1> /dev/null;
RESULT=$?
[ $RESULT -ne 0 ] && echo "JSON syntax faulty: $file" && exit 1
done
git stash pop -q
exit 0
This post is late because, two days ago (December 24th), I went to the emergency
room with appendicitis. Pretty sweet timing, eh?
After surgery, I was bored and took to observing nursing shift rotations -
hand-offs of patients, documentation maintenance, etc. The entire process semeed
to last about an hour for each shift change. I thought to myself, "Self, you
have never been involved in any operations project, task, or fire hand-off that
went as smoothly." Pretty sad realization.
Further, throughout my hospital stay (emergency room, surgery, and recovery),
server {
listen 80;
server_name foo.bar;
rewrite ^(.*) https://foo.bar$1? permanent;
}
@jeekl
jeekl / tmux.conf
Last active December 11, 2015 01:38
set -g default-terminal "screen-256color"
bind-key C-b last-window
# start window index of 1 instead of 0
set-option -g base-index 1
# UTF-8 character support in the status bar
set-option -g status-utf8 on
# Set window notifications
@jeekl
jeekl / gist:5083506
Created March 4, 2013 16:30
git update-hook script for checking versions of cookbooks and rejecting on non version bump
#!/usr/bin/env ruby
# Compares semantic versions of cookbooks, by looking at the metadata.rb file and
# rejects pushes if the cookbook version has not been bumped. If running this
# script from another script, remeber to pass along the parameters to this
# script.
#
# Requires a gem install semantic.
require 'rubygems'
require 'semantic'
@jeekl
jeekl / gist:5083519
Created March 4, 2013 16:32
git pre-commit hook to validate json objects so you don't commit broken json.
#!/usr/bin/env bash
# Runs all .json or .js files through pythons json lint tool before commiting,
# to make sure that you don't commit broken json objects.
git_dir=$(git rev-parse --show-toplevel)
for file in $(git diff-index --name-only --diff-filter=ACM --cached HEAD -- \
| grep -P '\.((js)|(json))$'); do
python -mjson.tool $file 2> /dev/null
if [ $? -ne 0 ] ; then
@jeekl
jeekl / update.jsonlint.sh
Created March 6, 2013 16:57
update.jsonlint.sh: git update hook for checking syntax of json objects. update.ruby-syntax.sh: git update hook for checking ruby syntax.
#!/usr/bin/env bash
# Runs all .json or .js files through pythons json lint tool before updating,
# to make sure that you don't push broken json objects.
refname=$1
old=$2
new=$3
for file in $(git ls-tree --name-only -r $new \
| grep -P '\.((js)|(json))$'); do
@jeekl
jeekl / gist:5300590
Created April 3, 2013 11:58
simple example of adding a user and ssh key in chef
username = "foo"
homedir = "/home/#{username}"
user username do
action :create
comment "foo user"
home homedir
supports :manage_home => true
end
# yum list --showduplicates nodejs
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Available Packages
nodejs.x86_64 0.10.1-1.el6 thirdparty
nodejs.x86_64 0.10.2-1.el6 thirdparty
nodejs.x86_64 0.10.3-1.el6 thirdparty
# shef -z