Skip to content

Instantly share code, notes, and snippets.

View jodell's full-sized avatar

Jeffrey ODell jodell

View GitHub Profile
noremap <leader>m :!markdown < % > /tmp/%.html; open file:///tmp/%.html<CR>
echo 'foo' | sudo tee -a bar
sudo update-alternatives --set editor /usr/bin/vim.basic
@jodell
jodell / os_check.sh
Created January 26, 2011 17:31
simple OS check
#!/bin/bash
if [ $OSTYPE = 'linux-gnu' ]; then
if [ -f /etc/debian_version ]; then
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
echo "Debian Stuff"
elif [ -f /etc/redhat-release ]; then
DIST=`cat /etc/redhat-release |sed s/\ release.*//`
echo "Redhat Stuff"
fi
DIRECTORY=$(cd `dirname $0` && pwd)
@jodell
jodell / gist:814707
Created February 7, 2011 16:55
track-after-the-fact
git branch --set-upstream master remotes/origin/master
# http://linuxcommando.blogspot.com/2008/10/how-to-disable-ssh-host-key-checking.html
sed -i 3d ~/.ssh/known_hosts
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]
#Host 192.168.0.*
# StrictHostKeyChecking no
# UserKnownHostsFile=/dev/null
@jodell
jodell / rc
Created February 16, 2011 16:45
# Automagic agent forwarding in remote screen sessions
#
# From http://superuser.com/questions/180148/how-do-you-get-screen-to-automatically-connect-to-the-current-ssh-agent-when-re-a
# In ~/.ssh/rc
#!/bin/bash
if test "$SSH_AUTH_SOCK" ; then
ln -sfv $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
@jodell
jodell / redirection
Created March 29, 2011 16:06
redirection reminders
2>null # silence stderr
># # silence stdout
2>&1 # redirect stderr to stdout
1>&2 # redirect stdout to stderr
1><2 # swap stdout and stderr
git push origin mybranch:remotebranch