Skip to content

Instantly share code, notes, and snippets.

@abn
abn / .bashrc.docker.sh
Last active January 16, 2016 08:18
.bashrc additions for docker sugar
# .bashrc.docker
# get id of last container started
docker-last() { docker ps -l -q ;}
# http://www.commandlinefu.com/commands/view/15050/attach-to-bash-shell-in-the-last-container-you-started
docker-exec() { docker exec -i -t $(docker-last) ${@-bash} ;}
# get ip of container with given id (default: last started container)
docker-ip() { docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${1-$(docker-last)} ;}
@JanTvrdik
JanTvrdik / .bashrc
Last active May 31, 2024 08:15 — forked from gsomoza/.bashrc
ssh-agent support for Git Bash / MinGW / msys / Windows
# put this in ~/.bashrc
export SSH_AUTH_SOCK=/tmp/.ssh-socket
ssh-add -l > /dev/null
if [ $? = 2 ]; then
rm -f $SSH_AUTH_SOCK
echo Starting new ssh-agent...
eval $(ssh-agent -a $SSH_AUTH_SOCK) > /dev/null
ssh-add && echo "ssh-agent set up successfully with the following keys:" && ssh-add -l
fi
@ahoward
ahoward / tail-f.rb
Created March 7, 2012 16:44
completely k.i.s.s technique to do realtime log tailing in a live rails' app from the browser
### blogged @ http://dojo4.com/blog/easy-cheasy-realtime-log-tailing-in-a-rails-admin-view
### the su controller action
def logs
log = File.join(Rails.root, "log", "#{ Rails.env }.log")
@lines = `tail -1024 #{ log }`.split(/\n/).reverse