Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am developernotes on github.
  • I am developernotes (https://keybase.io/developernotes) on keybase.
  • I have a public key whose fingerprint is 61DE BD73 2F3F 0777 1269 972E 2F87 3048 08D4 0CEC

To claim this, I am signing this object:

@developernotes
developernotes / brew-list-dependencies.rb
Created April 30, 2015 15:18
List installed homebrew packages and their dependencies
require 'utils'
class ListDependencies
def run
@command = <<-EOT
brew list | while read cask; do
printf "\e[1;34m%s ->\e[1;37m" "$cask";
brew deps $cask | awk '{printf(" %s ", $0)}'; echo "";
done
module Kernel
def min(*args)
[*args].sort.first
end
end
module Kernel
def min(*args)
[*args].inject {|a,b| a = a < b ? a : b}
end
end
function extract {
echo Extracting $1 ...
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
#!/bin/sh
# Send the file to our running Emacs and bring it to the foreground.
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient "${1}" \
2> /dev/null \
&& open -a Emacs
# If that failed, then open a new emacs visiting the file.
if [ $? -ne 0 ]; then
EOPEN_DIR="${PWD}" EOPEN_FILE="${1}" open -a Emacs
#!/bin/sh
# Send the file to our running Emacs and bring it to the foreground.
~/tools/emacs/bin/emacsclient "${1}" \
2> /dev/null \
# If that failed, then open a new emacs visiting the file.
if [ $? -ne 0 ]; then
dir=sed "/s/\/cygdrive\//g/" ${PWD} 2> /dev/null
EOPEN_DIR="${dir}" EOPEN_FILE="${1}" ~/tools/emacs/bin/runemacs.exe
#import <Foundation/Foundation.h>
@interface NSString(Extensions)
-(NSString *) sha1Hash;
@end
@developernotes
developernotes / brew-update-all.rb
Created December 26, 2010 17:43
Updates homebrew, installed packages and cleans up old packages
require 'utils'
class UpdateAll
def run
display("Updating homebrew and all installed packages, also cleaning up old packages:")
safe_system("brew update && brew upgrade && brew cleanup")
end
def display(message, &block)