Skip to content

Instantly share code, notes, and snippets.

@drbraden
drbraden / watchdock.sh
Last active December 22, 2015 01:28
Use socat to monitor docker's pipe
socat -v UNIX-LISTEN:listener,fork UNIX:/var/run/docker.sock
@drbraden
drbraden / gist:2bdb8092760e850a7f49
Last active August 29, 2015 14:06
Upgrade bash on Debian Lenny (5.0), and other older systems
#
# Method of upgrading bash on Debian 5.0, in order to fix
# the vulnerability "shellshock", officially known as:
#
# CVE-2014-6271
# CVE-2014-7169
#
# The credit for this belongs to user "cft" on Hacker News,
# for upgrading Ubuntu 8.04: https://news.ycombinator.com/item?id=8371438
#
@drbraden
drbraden / gist:ec94c02b7a2010359a63
Created October 23, 2014 19:05
Using Capistrano to deploy files to directory not owned by user
template = ERB.new(File.read('templates/UI/httpd.conf.erb'))
result = template.result(binding)
put(result, "/etc/httpd/httpd.conf")
@drbraden
drbraden / gist:9be3000b1e381e159632
Last active August 29, 2015 14:11
How to remap "jj" or "jk" to Escape in Atom when using vim-mode
# Built from a couple of comments at https://github.com/atom/vim-mode/issues/334
# In ~/.atom/init.coffee
atom.workspaceView.command 'insert-incomplete-keybinding', (e)->
if oe = e.originalEvent && e.originalEvent.originalEvent
char = String.fromCharCode(oe.which)
char = char.toLowerCase() unless oe.shift
atom.workspace.activePaneItem.insertText(char)
# In ~/.atom/keymap.cson
'.editor.vim-mode.insert-mode':
@drbraden
drbraden / kernelklean.sh
Created December 13, 2014 12:12
kernelklean
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
@drbraden
drbraden / gist:84dd9b16652527ab952c
Last active August 29, 2015 14:18
Use a newer version of Postgres with dokku-alt
source: https://github.com/dokku-alt/dokku-alt/issues/234
This assumes a fresh install, so no data migration to complicate things.
From a comment by ayufan on 4/6/2015:
Ok. You have to add to /home/dokku/.dokkurc:
export POSTGRESQL_IMAGE=ayufan/dokku-alt-postgresql:9.3
@drbraden
drbraden / gist:d4a3a1caf09429d0b842
Last active August 29, 2015 14:25
Allow "jj" to exit insert mode in Atom (working as of 1.0.2)
# Slightly modified version created by rdlugosz at https://github.com/atom/vim-mode/issues/334#issuecomment-85603175
#keymap.cson
'atom-text-editor.vim-mode.insert-mode':
'j': 'exit-insert-mode-if-preceded-by-j'
#init.coffee
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-preceded-by-j': (e) ->
editor = @getModel()
pos = editor.getCursorBufferPosition()
range = [pos.traverse([0,-1]), pos]
@drbraden
drbraden / gist:6b7d455190976b16526f
Last active August 29, 2015 14:26
UnixBench run on CloudAtCost
Link to results: http://serverbear.com/benchmark/2015/08/05/8UqD6Mj04RlXNWOZ
# # # # # # # ##### ###### # # #### # #
# # ## # # # # # # # ## # # # # #
# # # # # # ## ##### ##### # # # # ######
# # # # # # ## # # # # # # # # #
# # # ## # # # # # # # ## # # # #
#### # # # # # ##### ###### # # #### # #
Version 5.1.3 Based on the Byte Magazine Unix Benchmark
@drbraden
drbraden / Envoy.blade.php
Last active November 21, 2015 11:19 — forked from boris-glumpler/Envoy.blade.php
Envoy file with deployment tasks
{{-- Define all our servers --}}
@servers(['staging' => '', 'production' => ''])
@setup
{{-- The timezone your servers run in --}}
$timezone = 'Europe/Amsterdam';
{{-- The base path where your deployments are sitting --}}
$path = '/var/www/site.com/htdocs';
@drbraden
drbraden / .muttrc
Created April 5, 2016 05:43 — forked from tubbo/.muttrc
##
## Email configuration.
##
# IMAP Connection
set imap_user = 'tomphoolery@me.com'
set imap_pass = 'youwish'
set spoolfile = 'imaps://imap.mail.me.com:993/INBOX'
set folder = 'imaps://imap.gmail.com:993'