Skip to content

Instantly share code, notes, and snippets.

View mattsears's full-sized avatar
👋
Hello friend

Matt Sears mattsears

👋
Hello friend
View GitHub Profile
# Bash Completions for SSH known_hosts and config hosts
complete -W "$(echo `cat ~/.ssh/known_hosts | cut -f 1 -d ' ' | sed -e s/,.*//g | uniq | grep -v "\["`;)" ssh
complete -W "$(echo `cat ~/.ssh/config | cut -f1,2 -d ' ' | sed -e 's/Host[^s+]//g; s/^ *//; s/ *$//; /#.*/d' -e '/^$/d' | uniq`;)" ssh
# A handy way to display lists from collection
def list(stuff, options = {}, &block)
return content_tag(:p, "None") if stuff.nil? || stuff.empty?
content_tag(:ul, stuff.map { |thingie| content_tag(:li, yield(thingie)) }, options)
end