Skip to content

Instantly share code, notes, and snippets.

View michaelwclark's full-sized avatar

Michael W Clark michaelwclark

  • @LendersCooperative.com
  • Des Moines
View GitHub Profile
@michaelwclark
michaelwclark / .gitconfig
Created November 19, 2012 14:58
Git Config. Includes colored logs, aliases, and MBC project specific info.
[user]
email = [email protected]
name = Michael Clark
[credential]
helper = osxkeychain
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
rmb = !sh -c 'git branch -D $1 && git push origin :$1' -
cob = checkout -b
up = !git fetch origin && git rebase origin/master
@michaelwclark
michaelwclark / GetPID.rb
Created November 16, 2012 22:43
Gets PID(s) of matching argument query if there are any and outputs them nicely with Echo.rb (git://gist.github.com/4091319.git).
#!/usr/bin/env ruby
class GetPid
#Main
ARGV.each do |arg|
puts `Echo.rb bold red "Query: #{arg}"`
pids=`ps aux | grep -v grep | grep #{arg} | awk '{print $2}'`.split("\n")
pids.each do |pid|
puts `Echo.rb bold blue "\tPID: #{pid}"`
end
@michaelwclark
michaelwclark / Echo.rb
Created November 16, 2012 22:07
Ruby script I wrote to help me learn the language better. It is an echo like utility that utilizes english colors/modes for terminal output rather than complicated char codes. It's not fully polished or the most practical of tools, but it worked for what
#!/usr/bin/env ruby
#Usage:
# Echo.bold OutputString
#
# \e[z;XX;YYm
class TermFormat
@DEFAULTS ={
@michaelwclark
michaelwclark / ActiveRubyVer.sh
Created November 16, 2012 21:57
Command line command for getting current active version of Ruby. Tested on OSX 10.8.2 w/ zsh and iTerm2. RVM + iTerm = headaches. Hopefully this helps someone else out there..
#!/bin/bash -e
echo `ruby -v | sed 's/(.*//g' | sed 's/ruby//g' |sed 's/ //g' |sed 's/[ \t]*$//'`
# I realized after spending about 30 minutes on building up this command for my zsh Prompt that
# rvm_ruby_string contains the same thing.
# However, the reason I added this to my prompt is RVM kept giving me problems with not switching from OSX inbuilt ruby to the
# current environment...so adding an indicator always helps.