This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # git helpers - davidhq | |
| function git_repo { | |
| local root=$(git rev-parse --show-toplevel || echo ".") | |
| local cwd=`pwd` | |
| cd $root | |
| local origin=$(git remote -v | grep origin | grep push | sed 's/origin//g' | sed 's/[email protected]://g' | sed 's/https:\/\/github.com\///g' | sed 's/.git (push)//g' | xargs) | |
| cd $cwd | |
| eval "$1=$origin" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YELLOW='\033[0;33m' | |
| GREEN='\033[0;32m' | |
| RED='\033[0;31m' | |
| BLUE='\033[0;34m' | |
| NC='\033[0m' # No Color | |
| function loc { | |
| if [ -z "$1" ] || [ "$1" == "all" ]; then | |
| loc js "$2" | |
| loc jsx "$2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| // "Fork" Geth | |
| // add: | |
| // func DecryptKeyFromFile(keysDirPath string, keyAddr common.Address, auth string) (keyBytes []byte, keyId []byte, err error) { | |
| // return decryptKeyFromFile(keysDirPath, keyAddr, auth) | |
| // } | |
| // to crypto/key_store_passphrase.go | |
| import ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module My.Data.List where | |
| data List a = Cons a (List a) | Nil | |
| instance showList :: (Show a) => Show (List a) where | |
| show (Cons x xs) = (show x) ++ " : " ++ show xs | |
| show Nil = "Nil" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YELLOW='\033[0;33m' | |
| GREEN='\033[0;32m' | |
| RED='\033[0;31m' | |
| BLUE='\033[0;34m' | |
| NC='\033[0m' # No Color | |
| alias root="sudo -i" | |
| # utility function | |
| function current_usage { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| YELLOW='\033[1;33m' | |
| NC='\033[0m' # No Color | |
| # Usage: | |
| # m → mix help | |
| # m a → mix archive | |
| # m h → mix hex | |
| # m a.b → mix archive.build | |
| # m d.co → mix deps.compile | |
| # m p.n → mix phoenix.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example: | |
| # | |
| # $ find . | grep core_ext | |
| # ./config/initializers/core_ext.rb | |
| # ./spec/lib/core_ext_spec.rb | |
| # | |
| # $ grab 2 | |
| # ./spec/lib/core_ext_spec.rb ===> (also copied on clipboard) | |
| # | |
| # Without arguments the default is to grab the first line |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # swiss knife | |
| function c { | |
| local dir | |
| dir=`pwd` | |
| if [ -z "$1" ]; then | |
| cd - > /dev/null | |
| else | |
| if [ -d "$1" ]; then | |
| cd "$1" | |
| elif [ -f "$1" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function rspec { | |
| command rspec $@ | |
| if [ $? -ne 0 ]; then | |
| afplay ~/Misc/dumb.mp3 -v 0.3 | |
| fi | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # p proj -> cd ~/Projects/project | |
| # works best (fastest) if your projects are lower-case and you refer to them as such | |
| # if not, then for best performance (no lag) you have to call "p Proj" (if ~/Projects/Project exists) | |
| function p { | |
| cd ~/Projects | |
| local match | |
| if [ -n "$1" ]; then | |
| local min_size=1000 | |
| # first try only directories that start exactly with our input | |
| for d in $1*/ ; do |