Skip to content

Instantly share code, notes, and snippets.

View bdossantos's full-sized avatar

Benjamin Dos Santos bdossantos

View GitHub Profile
@xuru
xuru / apt-upgrade.sh
Created July 10, 2012 17:42
non-interactive debian/ubuntu upgrade
#! /bin/sh
PATH=/usr/sbin:/sbin:/usr/bin:/bin
cat <<EOF > /etc/apt/apt.conf.noninteractive
APT::Get::Assume-Yes "true";
APT::Get::Show-Upgraded "true";
APT::Quiet "true";
DPkg::Options {"--force-confmiss";"--force-confold"};
DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
@bhenerey
bhenerey / ideal ops.md
Created May 23, 2012 19:40
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

@jlecour
jlecour / kill_passenger_orphans.sh
Created May 21, 2012 08:22
A script to kill Passenger processes that are not known anymore by the watchdog
#!/bin/bash
set -e
# overridable defaults
GEM_HOME=${GEM_HOME:-/usr/local/passenger}
PASSENGER_BIN_PATH=${PASSENGER_BIN_PATH:-$GEM_HOME/bin}
PASSENGER_TMPDIR=${PASSENGER_TMPDIR:-/var/tmp}
PATH=$PATH:$PASSENGER_BIN_PATH
@simonjodet
simonjodet / gist:2713959
Created May 16, 2012 21:07
Nginx configuration for pretty URLs in Silex
server
{
listen 80;
server_name website.loc www.website.loc;
access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log;
root /var/www/website.loc/web/;
index index.php;
@sorccu
sorccu / npm.rb
Created May 10, 2012 08:48
puppet npm provider
# NPM provider for Puppet.
#
# Author:: Simo Kinnunen
# Copyright:: Copyright (c) 2012 CyberAgent, Inc.
# See:: http://rcrowley.org/talks/sv-puppet-2011-01-11/
# See:: https://github.com/newLoki/puppet-npm/
# See:: https://github.com/rcrowley/puppet-pip/
require 'puppet/provider/package'
@rtomayko
rtomayko / gist:2601550
Created May 5, 2012 10:58
Open beautiful git-scm.com manual pages w/ git help -w
# The new git-scm.com site includes man pages designed for pleasant viewing in a web browser:
#
# http://git-scm.com/docs
#
# The commands below can be used to configure git to open these pages when
# using `git help -w <command>' from the command line. Just enter the config
# commands in your shell to modify your ~/.gitconfig file.
# Create a new browser command and configure help -w to use it.
git config --global browser.gitscm.cmd "/bin/sh -c 'open http://git-scm.com/docs/\$(basename \$1 .html)' --"
@Munter
Munter / optimizeimages.sh
Created May 2, 2012 12:44
Shell script to recursively optimize all image in the current directory. WARNING: THIS OVERWRITES YOUR ORIGINALS AND REMOVES METADATA!
#!/bin/sh
set -o errexit
PNGS=`find . -iname "*.png"`
JPGS=`find . -iname "*.jpg"`
TMP1="_TMP1.PNG"
TMP2="_TMP2.PNG"
echo "Optimizing PNG"
for PNG in ${PNGS}
@hcarvalhoalves
hcarvalhoalves / nginx_status_codes.rb
Created May 1, 2012 17:58 — forked from mipearson/nginx_status_codes.rb
Very simple munin plugin to graph nginx HTTP error codes
#!/usr/bin/env ruby
CODES = {
'400' => 'Bad Request',
'401' => 'Unauthorized',
'403' => 'Forbidden',
'404' => 'Not Found',
'405' => 'Method Not Allowed',
'406' => 'Not Acceptable',
'408' => 'Request Timeout',
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@futuremill-ltd
futuremill-ltd / gist:2318876
Created April 6, 2012 11:00
Building Ruby 1.9.3 package for Debian Squeeze
# From a fresh install of squeeze
apt-get install ruby rubygems # Need ruby to use fpm
gem1.8 install fpm --no-ri --no-rdoc
apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -zxvf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
rm -rf /tmp/ruby193