michaelfox + environment 109
Kamal Meattle on how to grow fresh air | Video on TED.com
february 2012 by michaelfox
Researcher Kamal Meattle shows how an arrangement of three common houseplants, used in specific spots in a home or office building, can result in measurably cleaner indoor air.
With its air-filtering plants and sustainable architecture, Kamal Meattle's office park in New Delhi is a model of green business. Meattle himself is a longtime activist for cleaning up India's air.
air
environment
health
plants
video
ted
lecture
With its air-filtering plants and sustainable architecture, Kamal Meattle's office park in New Delhi is a model of green business. Meattle himself is a longtime activist for cleaning up India's air.
february 2012 by michaelfox
Set the DNS server under OS X - Stack Overflow
september 2011 by michaelfox
domain> <1.Nameserver> [2.Nameserver]"
echo "Example
dns
osx
shell
environment
hacks
echo "Example
september 2011 by michaelfox
(Re)installing PHP 5.3 on Mac OS X | justin hileman dot info
february 2011 by michaelfox
pear install PHP_CodeSniffer-beta
mac
php
osx
homebrew
brew
pear
environment
february 2011 by michaelfox
Information Property List Key Reference: Introduction
december 2010 by michaelfox
“About Information Property List Files” provides an overview of information property list files and how you configure them.
“Core Foundation Keys” describes the keys that provide basic information about the bundle configuration.
“Launch Services Keys” describes the keys used by Launch Services to obtain information about a bundle.
“Cocoa Keys” describes the keys supported by Cocoa and Cocoa Touch applications.
“Mac OS X Keys” describes keys supported by Mac OS X bundles.
“UIKit Keys” describes the keys specific to iOS applications.
propertylist
plist
osx
cocoa
objective-c
environment
settings
config
reference
“Core Foundation Keys” describes the keys that provide basic information about the bundle configuration.
“Launch Services Keys” describes the keys used by Launch Services to obtain information about a bundle.
“Cocoa Keys” describes the keys supported by Cocoa and Cocoa Touch applications.
“Mac OS X Keys” describes keys supported by Mac OS X bundles.
“UIKit Keys” describes the keys specific to iOS applications.
december 2010 by michaelfox
gist: 579814 - Use one of these techniques to install node and npm without having to sudo- GitHub
december 2010 by michaelfox
Use one of these techniques to install node and npm without having to sudo
install
node
setup
environment
shell
config
permissions
december 2010 by michaelfox
Setting up a Rails Development System on Mac OSX Snow Leopard | SpyreStudios
december 2010 by michaelfox
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
rvm install 1.8.7 --with-arch=x86_64 --enable-shared --with-readline-dir=/usr/local
rvm install 1.9.2 --with-arch=x86_64 --enable-shared --with-readline-dir=/usr/local
rvm --default use 1.9.2
rvm use --create 1.9.2@rails3
gem install sqlite3-ruby
gem install rails
rails
ruby
rvm
osx
environment
setup
install
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
rvm install 1.8.7 --with-arch=x86_64 --enable-shared --with-readline-dir=/usr/local
rvm install 1.9.2 --with-arch=x86_64 --enable-shared --with-readline-dir=/usr/local
rvm --default use 1.9.2
rvm use --create 1.9.2@rails3
gem install sqlite3-ruby
gem install rails
december 2010 by michaelfox
Hivelogic - My Setup, Part II: The Software
december 2010 by michaelfox
A while back, I wrote an article about my hardware configuration, with a promise to write a similar article about the software I use. So, this article is Part II of the series, detailing the software I use on a daily basis. One my favorite ways to learn about new tools is through a colleague’s recommendation. Hopefully there might be something useful here that you haven’t heard about yet.
Before I dive in, it might be worth mentioning that my hardware setup has changed a bit. While I still use my powerbook (Guru) quite a bit, my primary machine is now an iMac Intel Core Duo 20”, with 1.5 GB of RAM.
setup
config
environment
system
Before I dive in, it might be worth mentioning that my hardware setup has changed a bit. While I still use my powerbook (Guru) quite a bit, my primary machine is now an iMac Intel Core Duo 20”, with 1.5 GB of RAM.
december 2010 by michaelfox
Abracode Shortcuts
november 2010 by michaelfox
Abracode
Website: http://www.abracode.com/free/cmworkshop/
What is it?
Shortcuts is a Mac OS X application to assign hot keys to contextual menu items. It works only with menu items added by contextual menu plug-ins. Version 2.0 also allows you to display a menu with items added by CM plug-ins.
Requirements
Mac OS 10.5 or higher.
Some useful contextual menu plug-ins highly recommended.
In Mac OS 10.6 Shortcuts is the only method to use contextual menu plug-ins in 64 bit applications.
Introduction
Ever wanted to assign a hot key combination to contextual menu item? "Shortcuts" is the answer. It allows you to assign a hot key combination to chosen menu item so you can select some object (file in Finder or text) and hit keyboard combination to execute the task normally performed by choosing that menu item.
Shortcuts works with contextual menu plug-ins only. It does not work with menu items added by the application which shows the menu. For example, when you ctrl-click on Desktop in Finder you have "New Folder" and other items added by Finder. You cannot assign shortcuts to those items. But the same contextual menu also shows some items added by plug-ins — in default Mac OS 10.4 installation it would see Automator and folder actions items which are added by Apple-provided plug-ins — and you can assign shortcuts to those items. Of course you probably need to have some third party contextual menu plug-ins installed to make good use of "Shortcuts". But even if you used it only for one frequently used item it would be worth installing and getting the benefits of much faster execution.
Unfortunately not all contextual menu plug-ins will work with "Shortcuts". Only contextual menu items which play by the rules will work. So what are the rules? The rules are: when the context information (selected text of file information) is passed to the contextual menu plug-in, it should advertise available commands by returning the menu item name. It seems obvious but some plug-ins do it in a different way. They do not provide the names of their contextual menu items when asked and they try to add those items to menu later. You will not be able assign shortcuts to those items because in most cases they will not show up at all when "Shortcuts" tries to query all plugins. Another class of problematic plug-ins are those which restrict their visibility to certain applications only — for example some plug-ins may show only in Finder. In such case "Shortcuts" will not see their items.
extension
gui
keyboard
mac
shortcuts
environment
osx
hacks
context
Website: http://www.abracode.com/free/cmworkshop/
What is it?
Shortcuts is a Mac OS X application to assign hot keys to contextual menu items. It works only with menu items added by contextual menu plug-ins. Version 2.0 also allows you to display a menu with items added by CM plug-ins.
Requirements
Mac OS 10.5 or higher.
Some useful contextual menu plug-ins highly recommended.
In Mac OS 10.6 Shortcuts is the only method to use contextual menu plug-ins in 64 bit applications.
Introduction
Ever wanted to assign a hot key combination to contextual menu item? "Shortcuts" is the answer. It allows you to assign a hot key combination to chosen menu item so you can select some object (file in Finder or text) and hit keyboard combination to execute the task normally performed by choosing that menu item.
Shortcuts works with contextual menu plug-ins only. It does not work with menu items added by the application which shows the menu. For example, when you ctrl-click on Desktop in Finder you have "New Folder" and other items added by Finder. You cannot assign shortcuts to those items. But the same contextual menu also shows some items added by plug-ins — in default Mac OS 10.4 installation it would see Automator and folder actions items which are added by Apple-provided plug-ins — and you can assign shortcuts to those items. Of course you probably need to have some third party contextual menu plug-ins installed to make good use of "Shortcuts". But even if you used it only for one frequently used item it would be worth installing and getting the benefits of much faster execution.
Unfortunately not all contextual menu plug-ins will work with "Shortcuts". Only contextual menu items which play by the rules will work. So what are the rules? The rules are: when the context information (selected text of file information) is passed to the contextual menu plug-in, it should advertise available commands by returning the menu item name. It seems obvious but some plug-ins do it in a different way. They do not provide the names of their contextual menu items when asked and they try to add those items to menu later. You will not be able assign shortcuts to those items because in most cases they will not show up at all when "Shortcuts" tries to query all plugins. Another class of problematic plug-ins are those which restrict their visibility to certain applications only — for example some plug-ins may show only in Finder. In such case "Shortcuts" will not see their items.
november 2010 by michaelfox
OnMyCommand
november 2010 by michaelfox
OnMyCommand is a UNIX shell script and AppleScript executor. You can build your own Contextual Menu Item or GUI application.
For more information on building command descriptions see Command Description Manual.
Sources are included with Contextual Menu Workshop. Newest sources are available on request.
applescript
mac
osx
software
unix
bash
shell
context
menu
tools
plugins
development
environment
programming
productivity
hacks
For more information on building command descriptions see Command Description Manual.
Sources are included with Contextual Menu Workshop. Newest sources are available on request.
november 2010 by michaelfox
Kicking the Vim cursor key habit « lamby
november 2010 by michaelfox
" Unbind the cursor keys in insert, normal and visual modes. for prefix in ['i', 'n', 'v'] for key in ['<Up>', '<Down>', '<Left>', '<Right>'] exe prefix . "noremap " . key . " <Nop>" endfor endfor
vim
keyboard
shortcuts
vimrc
snippets
setup
environment
tools
resources
reference
tips
editor
november 2010 by michaelfox
Introduction to using vim for Rails development ... - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
november 2010 by michaelfox
Introduction to using vim for Rails development
Someone recently asked us to do “vim on Rails” screencasts.
So, we’re responding with this experiment. Let us know if this is valuable and we’ll try to improve things like audio quality.
rails
screencast
ide
screencasts
tutorial
ruby
development
editor
vim
linux
howto
video
environment
tools
resources
reference
dotfiles
config
setup
Someone recently asked us to do “vim on Rails” screencasts.
So, we’re responding with this experiment. Let us know if this is valuable and we’ll try to improve things like audio quality.
november 2010 by michaelfox
Integrating vim into your life - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
november 2010 by michaelfox
More tips from thoughtbot about using vim, but this time with an emphasis on fitting it into your life.
vim
development
editor
howto
rails
reference
tips
command
cli
vimrc
settings
environment
tools
resources
ctags
keyboard
shortcuts
november 2010 by michaelfox
For the Developer | Local Host Entries on OS X Snow Leopard
november 2010 by michaelfox
Today I wanted to setup local host entries on my MacBook. Searching around I found several articles about editing the /private/etc/hosts file to add local domains entries pointing back to my computer. I don’t know if it is something that changed with Leopard or Snow Leopard but it just wasn’t working for me. Even restarting the computer was a no go.
Using the dscl Utility
With the wonder of Google searching and the generous comments of others I found out about the dscl utility.
Listing Host Entries
To see what is listed for your hosts at any time just run this command:
dscl localhost -readall /Local/Default/Hosts
Adding a New Entry
In this example I am going to have the snow.ftd host point to my 127.0.0.1 IP address:
sudo dscl localhost -create /Local/Default/Hosts/snow.ftd IPAddress 127.0.0.1
You should now be able to ping snow.ftd and have it resolve to your local computer.
Removing an Existing Entry
If you decide you do not want an entry anymore just run this command to remove it:
sudo dscl localhost -delete /Local/Default/Hosts/snow.ftd
Reading the BSD Flat File
It was also noted that you can read the BSD flat file using this command:
dscl localhost -readall /BSD/local/Hosts
osx
hosts
virtualhosts
dscl
localhost
environment
config
Using the dscl Utility
With the wonder of Google searching and the generous comments of others I found out about the dscl utility.
Listing Host Entries
To see what is listed for your hosts at any time just run this command:
dscl localhost -readall /Local/Default/Hosts
Adding a New Entry
In this example I am going to have the snow.ftd host point to my 127.0.0.1 IP address:
sudo dscl localhost -create /Local/Default/Hosts/snow.ftd IPAddress 127.0.0.1
You should now be able to ping snow.ftd and have it resolve to your local computer.
Removing an Existing Entry
If you decide you do not want an entry anymore just run this command to remove it:
sudo dscl localhost -delete /Local/Default/Hosts/snow.ftd
Reading the BSD Flat File
It was also noted that you can read the BSD flat file using this command:
dscl localhost -readall /BSD/local/Hosts
november 2010 by michaelfox
Install Apache/PHP/MySQL on Snow Leopard
october 2010 by michaelfox
In /etc/apache2/httpd.conf, uncomment this line:
LoadModule php5_module libexec/apache2/libphp5.so
Restart Apache
sudo apachectl restart
Fix a warning appearing in phpinfo()
Create /etc/php.ini and make it writable
cd /etc
sudo cp php.ini.default php.ini
sudo chmod 666 php.ini
php
mac
osx
development
environment
server
testing
apache
mysql
linux
system
install
compile
LoadModule php5_module libexec/apache2/libphp5.so
Restart Apache
sudo apachectl restart
Fix a warning appearing in phpinfo()
Create /etc/php.ini and make it writable
cd /etc
sudo cp php.ini.default php.ini
sudo chmod 666 php.ini
october 2010 by michaelfox
Sean Coates blogs: php-5.2.5 on Leopard
october 2010 by michaelfox
development environment up and running (I did a clean install). After the jump, I'll outline the steps that I took to get a functioning Apache, PHP, MySQL installed. Sure, you could use the leopard-bundled Apache and PHP, but if you're like me, you generally upgrade PHP (and use weird extensions) a lot more often than Apple will upgrade it.
Built on Rasmus' birthday. How appropriate (-:
First, a couple things should be noted: I'm still without local SSL support on Apache. I've been in touch with the maintainer of apache2 on macports (who, coincidentally, is probably familiar to many of you due to his past work on the PHP project: James Cox), but I still don't have a solution. See this bug report for info. The second thing is that my colleague/client/boss/friend (wow.. that sounds like a dangerous combination!) Marco helped me out quite a bit with the initial leopard-friendly incantations to make things build.
php
mac
osx
development
environment
server
testing
apache
mysql
linux
system
install
compile
Built on Rasmus' birthday. How appropriate (-:
First, a couple things should be noted: I'm still without local SSL support on Apache. I've been in touch with the maintainer of apache2 on macports (who, coincidentally, is probably familiar to many of you due to his past work on the PHP project: James Cox), but I still don't have a solution. See this bug report for info. The second thing is that my colleague/client/boss/friend (wow.. that sounds like a dangerous combination!) Marco helped me out quite a bit with the initial leopard-friendly incantations to make things build.
october 2010 by michaelfox
HOWTO: Setup PHP, Apache and MySQL development environment on OS X Snow Leopard
october 2010 by michaelfox
UPDATED: Updated to use PHP 5.3.1 and with easier instructions for fixing PHP’s iconv linking problem via Apple’s iconv.patch file.
Although Mac OS X Snow Leopard (10.6) finally comes with current versions of open source software developers use, the default setup is not enough for our needs so we’ve compiled this easy to follow guide to setting up a PHP development environment including the following:
PHP 5.3
Apache 2.2
MySQL 5.1
As I mentioned, we needed to add a few things to the PHP install that Apple left out:
GeoIP
libjpeg
libpng
IMAP
libmcrypt
gettext
php
mac
osx
development
environment
server
testing
apache
mysql
linux
system
install
compile
Although Mac OS X Snow Leopard (10.6) finally comes with current versions of open source software developers use, the default setup is not enough for our needs so we’ve compiled this easy to follow guide to setting up a PHP development environment including the following:
PHP 5.3
Apache 2.2
MySQL 5.1
As I mentioned, we needed to add a few things to the PHP install that Apple left out:
GeoIP
libjpeg
libpng
IMAP
libmcrypt
gettext
october 2010 by michaelfox
isaacs's spark at master - GitHub
september 2010 by michaelfox
Spark is a command-line tool used to start up node server instances. It's part of the [Connect][] system, but can be used standalone with any node server.
node
javascript
command
cli
server
tools
environment
september 2010 by michaelfox
gist: 595024 - GitHub
september 2010 by michaelfox
# Command Enhancements
# Utility
alias reload='source ~/bin/dotfiles/bash/aliases'
alias ea='mate -w ~/bin/dotfiles/bash/aliases && reload' # Edit aliases
alias ee="mate ~/bin/dotfiles/bash/env"
alias eb="mate ~/bin"
# Quicker cd
alias cg='cd /Library/Ruby/Gems/1.8/gems/'
function cr() {
cd ~/repos/$*
}
function cdc() {
cd $1; ls
}
function cdw() {
cd ~/Websites/$1
}
alias c='clear'
alias cl='clear; l'
alias cls='clear; ls'
alias h='history'
alias hf="history | grep "
alias a='ls -A' # -A all except literal . ..
alias la="ls -A -l -G"
alias l.='ls -d .[^.]*'
alias l='ls -lhGt' # -l long listing, most recent first
# -G color
alias lh="ls -lh"
alias ll='ls -lhG' # -l long listing, human readable, no group info
alias lt='ls -lt' # sort with recently modified first
alias md='mkdir -p'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -iv'
alias cdd='cd -' # goto last dir cd'ed from
alias ..='cd ..' # up one dir
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'
function take() {
mkdir -p "$1"
cd "$1"
}
alias e='exit'
alias k9="killall -9"
function killnamed () {
ps ax | grep $1 | cut -d ' ' -f 2 | xargs kill
}
function zipr() {
zip -r $1.zip $1
}
# Finder
alias o='open . &'
alias ff='open -a Firefox'
# Processes
alias tu='top -o cpu' # cpu
alias tm='top -o vsize' # memory
# Git
alias ungit="find . -name '.git' -exec rm -rf {} \;"
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
# Commit pending changes and quote all args as message
function gg() {
git commit -v -a -m "$*"
}
alias gco='git checkout'
alias gd='git diff'
alias gdm='git diff master'
alias gl='git pull'
alias gnp="git-notpushed"
alias gp='git push'
alias gst='git status'
alias gt='git status'
alias g='git status'
alias eg='mate .git/config'
# Git clone from GitHub
function gch() {
git clone git://github.com/$USER/$1.git
}
# Setup a tracking branch from [remote] [branch_name]
function gbt() {
git branch --track $2 $1/$2 && git checkout $2
}
# Quickly clobber a file and checkout
function grf() {
rm $1
git checkout $1
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
source ~/bin/dotfiles/misc/git-completion.bash
# SVN
alias upw="gitit && cd ~ && svn up Websites/2.0/ Websites/vendor/ Websites/1.4/ Websites/projects/"
function svnrm() {
rm -rf `find . -type d -name .svn`
}
# MySQL
alias mysql='mysql -uroot -p --default-character-set=utf8'
alias mysqladmin='mysqladmin -uroot -p --default-character-set=utf8'
alias mysqldump='mysqldump -uroot -p --default-character-set=utf8'
# Text editing
# TextMate
alias et="mate"
alias ett="mate ."
alias m="mate ."
alias etr="mate app config lib db schema public spec test vendor/gems vendor/plugins Rakefile Capfile Vladfile Todofile README stories merb slices tasks features &"
_mategem() {
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
local gems="$(gem environment gemdir)/gems"
COMPREPLY=($(compgen -W '$(ls $gems)' -- $curw));
return 0
}
complete -F _mategem -o dirnames mategem
# Ruby
alias r="rake"
function markdown() {
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/Markdown.pl $1 > $1.html
}
#source ~/bin/ruby_switcher.sh
# if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
# Rails
alias rp='touch tmp/restart.txt'
alias sc='./script/console'
alias sg='./script/generate'
alias sp='./script/plugin'
alias ss='./script/server --debugger'
alias ss2='./script/server -p3001 --debugger'
alias tl='tail -f log/*.log'
alias ts='thin start'
alias autot='AUTOFEATURE=true bundle exec autotest'
function scap() {
cap $1 --set deploy_environment='staging'
}
# TDD / BDD
alias aa='autotest'
alias aaf='autotest -f' # Don't run all at start
alias aas="./script/autospec"
alias sss="./rake spec:server:start"
# Setup a tunnel
function haproxyssh() {
ssh -L7997:127.0.0.1:7997 deploy@$1.com
}
function tunnel() {
ssh -v -nNT -g -R *:$1:0.0.0.0:3000 $2
}
# Syntax check Javascript
function jsc() {
jsl -conf /etc/jsl/jsl.conf -process $1
}
function aiff2mp3() {
lame -h -V 0 $1.aif $1.mp3
}
function wav2mp3() {
lame -h -V 0 $1.wav $1.mp3
}
# XCode
# Analyze release build
alias sx="xcodebuild clean && ~/src/checker-0.146/scan-build -k -V xcodebuild"
# Analyze test build
alias sxt="xcodebuild -target Test clean && ~/src/checker-0.146/scan-build -k -V xcodebuild -target Test"
# Call with -target Foo
function sxx() {
xcodebuild $* clean && ~/src/checker-0.146/scan-build -k -V xcodebuild $*
}
alias ox="open *.xcodeproj"
# Nginx
function nginx_stop() {
ps ax | grep nginx | cut -d " " -f 1 | xargs sudo kill -9
}
function nginx_start() {
sudo /opt/nginx/sbin/nginx
}
# TaskPaper
function new-tp() {
touch $1.taskpaper
open $1.taskpaper
}
# From http://github.com/suztomo/dotfiles
function rmf() {
for file in $*
do
__rm_single_file $file
done
}
function __rm_single_file() {
if ! [ -d ~/.Trash/ ]
then
command /bin/mkdir ~/.Trash
fi
if ! [ $# -eq 1 ]
then
echo "__rm_single_file: 1 argument required but $# passed."
exit
fi
if [ -e $1 ]
then
BASENAME=`basename $1`
NAME=$BASENAME
COUNT=0
while [ -e ~/.Trash/$NAME ]
do
COUNT=$(($COUNT+1))
NAME="$BASENAME.$COUNT"
done
command /bin/mv $1 ~/.Trash/$NAME
else
echo "No such file or directory: $file"
fi
}
# Misc
alias dnsf="dscacheutil -flushcache"
function num_files() {
for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null
}
shopt -s histappend
dotfiles
bash
shell
aliases
environment
setup
# Utility
alias reload='source ~/bin/dotfiles/bash/aliases'
alias ea='mate -w ~/bin/dotfiles/bash/aliases && reload' # Edit aliases
alias ee="mate ~/bin/dotfiles/bash/env"
alias eb="mate ~/bin"
# Quicker cd
alias cg='cd /Library/Ruby/Gems/1.8/gems/'
function cr() {
cd ~/repos/$*
}
function cdc() {
cd $1; ls
}
function cdw() {
cd ~/Websites/$1
}
alias c='clear'
alias cl='clear; l'
alias cls='clear; ls'
alias h='history'
alias hf="history | grep "
alias a='ls -A' # -A all except literal . ..
alias la="ls -A -l -G"
alias l.='ls -d .[^.]*'
alias l='ls -lhGt' # -l long listing, most recent first
# -G color
alias lh="ls -lh"
alias ll='ls -lhG' # -l long listing, human readable, no group info
alias lt='ls -lt' # sort with recently modified first
alias md='mkdir -p'
alias cp='cp -i'
alias rm='rm -i'
alias mv='mv -iv'
alias cdd='cd -' # goto last dir cd'ed from
alias ..='cd ..' # up one dir
alias grep='GREP_COLOR="1;37;41" LANG=C grep --color=auto'
function take() {
mkdir -p "$1"
cd "$1"
}
alias e='exit'
alias k9="killall -9"
function killnamed () {
ps ax | grep $1 | cut -d ' ' -f 2 | xargs kill
}
function zipr() {
zip -r $1.zip $1
}
# Finder
alias o='open . &'
alias ff='open -a Firefox'
# Processes
alias tu='top -o cpu' # cpu
alias tm='top -o vsize' # memory
# Git
alias ungit="find . -name '.git' -exec rm -rf {} \;"
alias gb='git branch'
alias gba='git branch -a'
alias gc='git commit -v'
alias gca='git commit -v -a'
# Commit pending changes and quote all args as message
function gg() {
git commit -v -a -m "$*"
}
alias gco='git checkout'
alias gd='git diff'
alias gdm='git diff master'
alias gl='git pull'
alias gnp="git-notpushed"
alias gp='git push'
alias gst='git status'
alias gt='git status'
alias g='git status'
alias eg='mate .git/config'
# Git clone from GitHub
function gch() {
git clone git://github.com/$USER/$1.git
}
# Setup a tracking branch from [remote] [branch_name]
function gbt() {
git branch --track $2 $1/$2 && git checkout $2
}
# Quickly clobber a file and checkout
function grf() {
rm $1
git checkout $1
}
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
source ~/bin/dotfiles/misc/git-completion.bash
# SVN
alias upw="gitit && cd ~ && svn up Websites/2.0/ Websites/vendor/ Websites/1.4/ Websites/projects/"
function svnrm() {
rm -rf `find . -type d -name .svn`
}
# MySQL
alias mysql='mysql -uroot -p --default-character-set=utf8'
alias mysqladmin='mysqladmin -uroot -p --default-character-set=utf8'
alias mysqldump='mysqldump -uroot -p --default-character-set=utf8'
# Text editing
# TextMate
alias et="mate"
alias ett="mate ."
alias m="mate ."
alias etr="mate app config lib db schema public spec test vendor/gems vendor/plugins Rakefile Capfile Vladfile Todofile README stories merb slices tasks features &"
_mategem() {
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
local gems="$(gem environment gemdir)/gems"
COMPREPLY=($(compgen -W '$(ls $gems)' -- $curw));
return 0
}
complete -F _mategem -o dirnames mategem
# Ruby
alias r="rake"
function markdown() {
/Applications/TextMate.app/Contents/SharedSupport/Support/bin/Markdown.pl $1 > $1.html
}
#source ~/bin/ruby_switcher.sh
# if [ -s ~/.rvm/scripts/rvm ] ; then source ~/.rvm/scripts/rvm ; fi
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
# Rails
alias rp='touch tmp/restart.txt'
alias sc='./script/console'
alias sg='./script/generate'
alias sp='./script/plugin'
alias ss='./script/server --debugger'
alias ss2='./script/server -p3001 --debugger'
alias tl='tail -f log/*.log'
alias ts='thin start'
alias autot='AUTOFEATURE=true bundle exec autotest'
function scap() {
cap $1 --set deploy_environment='staging'
}
# TDD / BDD
alias aa='autotest'
alias aaf='autotest -f' # Don't run all at start
alias aas="./script/autospec"
alias sss="./rake spec:server:start"
# Setup a tunnel
function haproxyssh() {
ssh -L7997:127.0.0.1:7997 deploy@$1.com
}
function tunnel() {
ssh -v -nNT -g -R *:$1:0.0.0.0:3000 $2
}
# Syntax check Javascript
function jsc() {
jsl -conf /etc/jsl/jsl.conf -process $1
}
function aiff2mp3() {
lame -h -V 0 $1.aif $1.mp3
}
function wav2mp3() {
lame -h -V 0 $1.wav $1.mp3
}
# XCode
# Analyze release build
alias sx="xcodebuild clean && ~/src/checker-0.146/scan-build -k -V xcodebuild"
# Analyze test build
alias sxt="xcodebuild -target Test clean && ~/src/checker-0.146/scan-build -k -V xcodebuild -target Test"
# Call with -target Foo
function sxx() {
xcodebuild $* clean && ~/src/checker-0.146/scan-build -k -V xcodebuild $*
}
alias ox="open *.xcodeproj"
# Nginx
function nginx_stop() {
ps ax | grep nginx | cut -d " " -f 1 | xargs sudo kill -9
}
function nginx_start() {
sudo /opt/nginx/sbin/nginx
}
# TaskPaper
function new-tp() {
touch $1.taskpaper
open $1.taskpaper
}
# From http://github.com/suztomo/dotfiles
function rmf() {
for file in $*
do
__rm_single_file $file
done
}
function __rm_single_file() {
if ! [ -d ~/.Trash/ ]
then
command /bin/mkdir ~/.Trash
fi
if ! [ $# -eq 1 ]
then
echo "__rm_single_file: 1 argument required but $# passed."
exit
fi
if [ -e $1 ]
then
BASENAME=`basename $1`
NAME=$BASENAME
COUNT=0
while [ -e ~/.Trash/$NAME ]
do
COUNT=$(($COUNT+1))
NAME="$BASENAME.$COUNT"
done
command /bin/mv $1 ~/.Trash/$NAME
else
echo "No such file or directory: $file"
fi
}
# Misc
alias dnsf="dscacheutil -flushcache"
function num_files() {
for t in files links directories; do echo `find . -type ${t:0:1} | wc -l` $t; done 2> /dev/null
}
shopt -s histappend
september 2010 by michaelfox
Cinderella - A Development Environment for Macs
september 2010 by michaelfox
Cinderella is a fully managed development environment for open source hacking on Mac OSX. It's powered by rvm, homebrew and chef. You only need Xcode to get started.
Cinderella builds everything up in ~/Developer. It won't stomp on any of your current installations so you don't have to commit your entire machine immediately. It's simple to rollback if you really want to.
development
environment
mac
mysql
ruby
python
node
redis
memcache
osx
Cinderella builds everything up in ~/Developer. It won't stomp on any of your current installations so you don't have to commit your entire machine immediately. It's simple to rollback if you really want to.
september 2010 by michaelfox
Dotfiles Are Meant to Be Forked
september 2010 by michaelfox
I’m a big fan of customizing your dotfiles. “Dotfiles” are the funky little files in your *nix-based home directory that allow you to customize your nerdery: change how your prompt looks, set up your $PATH, adjust settings for Ruby’s IRB, completely change everything about Vim, and about a billion and a half other things. They’re fun.
In many ways, this loose framework is one of the most important tools you’ll use as a developer. It dictates how you use every other tool in your software arsenal. And everyone has different tastes, which I find fascinating: sit down at a crafty programmer’s shell for a minute and you’ll find that out pretty quick.
github
dotfiles
shell
bash
zsh
cli
config
setup
environment
In many ways, this loose framework is one of the most important tools you’ll use as a developer. It dictates how you use every other tool in your software arsenal. And everyone has different tastes, which I find fascinating: sit down at a crafty programmer’s shell for a minute and you’ll find that out pretty quick.
september 2010 by michaelfox
• How to share the same working copy between Git and Subversion | test.ical.ly
september 2010 by michaelfox
Last week I wrote a small post about me sneakily switching to Git for my own workflows.
However at my working place I still have to work with Subversion or at least interact with it.
Normally I do this with Git-SVN but that is not available on all servers I have to work on.
Here is my current configuration to ease this.
Working with two version control systems on one working copy can be a pain as both Git and Subversion store their meta information in specific files within your working copy.
One won’t recognise the meta files of the other and so identify them as new files valid for addition. This can be prevented.
My Subversion configuration
// ~/.subversion/config
...
[miscellany]
global-ignores = *.git *.swp
...
Using this setting all Git information files within the working copy will be ignored so you won’t accidentally commit them.
My Git configuration
$ git config --global core.excludesfile ~/.gitignore
$ echo .svn >> ~/.gitignore
$ echo .swp >> ~/.gitignore
And the same for my Git configuration ignoring all Subversion information files.
git
svn
setup
environment
However at my working place I still have to work with Subversion or at least interact with it.
Normally I do this with Git-SVN but that is not available on all servers I have to work on.
Here is my current configuration to ease this.
Working with two version control systems on one working copy can be a pain as both Git and Subversion store their meta information in specific files within your working copy.
One won’t recognise the meta files of the other and so identify them as new files valid for addition. This can be prevented.
My Subversion configuration
// ~/.subversion/config
...
[miscellany]
global-ignores = *.git *.swp
...
Using this setting all Git information files within the working copy will be ignored so you won’t accidentally commit them.
My Git configuration
$ git config --global core.excludesfile ~/.gitignore
$ echo .svn >> ~/.gitignore
$ echo .swp >> ~/.gitignore
And the same for my Git configuration ignoring all Subversion information files.
september 2010 by michaelfox
[TxMt] Setting default language for new documents
july 2010 by michaelfox
> Is there a way to set the default language for new documents to > something other than "plain text"? Yes, but it's a little tricky. First you need to find the UUID of the language you want as default. All the default languages are stored in TextMate.app/Contents/ SharedSupport/Bundles in the Syntaxes folder of the bundle. This is in the binary plist format, so you'll need to convert it first to readable form. Let's say we want HTML to be the new default language, we would do (from terminal): % cd /Applications/TextMate.app/Contents/SharedSupport/Bundles/ HTML.tmbundle/Syntaxes % plutil -convert xml1 HTML.plist % grep -A1 uuid HTML.plist <key>uuid</key> <string>17994EC8-6B1D-11D9-AC3A-000D93589AF6</string> Here “17994EC8-6B1D-11D9-AC3A-000D93589AF6” is the UUID. Now we need to tell TM to use that as default by altering its defaults database. First quit TextMate, then from terminal run: % defaults write com.macromates.textmate OakDefaultLanguage 17994EC8-6B1D-11D9-AC3A-000D93589AF6 Start TextMate, and notice how all new documents are set to be HTML by default.
textmate
osx
config
setup
environment
default
html
tools
july 2010 by michaelfox
Multi-node: Concurrent NodeJS HTTP Server | SitePen Blog
july 2010 by michaelfox
This entry is part 7 of 7 in the series Server-Side JavaScript, Pintura, and Persevere 2.0
NodeJS has demonstrated impressive performance potential as an HTTP server. By combining highly optimized HTTP parsing algorithms with the speedy V8 JavaScript engine and using an event-based architecture, Node has posted eye-opening request handling numbers. However, Node historically has been limited by its inability to provide true concurrent request handling, greatly limiting its ability to leverage increasingly multiple core servers. The latest release of Node introduced new functionality for socket sharing that can be coupled with child process spawning to achieve concurrent multi-process request handling for a single TCP socket. Multi-node exists to leverage this capability to make it simple to start up a multi-process Node server.
Multi-node is very easy to use. You simply create an HTTP server object as you would normally do, and rather than immediately calling listen(), you pass it to the multi-node listen function:
node
nodejs
server
admin
environment
NodeJS has demonstrated impressive performance potential as an HTTP server. By combining highly optimized HTTP parsing algorithms with the speedy V8 JavaScript engine and using an event-based architecture, Node has posted eye-opening request handling numbers. However, Node historically has been limited by its inability to provide true concurrent request handling, greatly limiting its ability to leverage increasingly multiple core servers. The latest release of Node introduced new functionality for socket sharing that can be coupled with child process spawning to achieve concurrent multi-process request handling for a single TCP socket. Multi-node exists to leverage this capability to make it simple to start up a multi-process Node server.
Multi-node is very easy to use. You simply create an HTTP server object as you would normally do, and rather than immediately calling listen(), you pass it to the multi-node listen function:
july 2010 by michaelfox
"Installing Zend Server & Zend Framework on OS X" by Chris Morrell
june 2010 by michaelfox
Installing the Zend Framework
Now download the latest version of the Zend Framework
Unzip and copy the following files:
* library/Zend to /usr/local/zend/share/ZendFramework/library/Zend
* extras/library/ZendX to /usr/local/zend/share/ZendFramework/library/ZendX
* bin to /usr/local/zend/share/ZendFramework/bin
* Please note that if you don’t need the zf command line tool, and the version of the Zend Framework that came with Zend Server is up-to-date, these steps are unnecessary
Finally, link the zf.sh file so you can access it easily:
* sudo ln -s /usr/local/zend/share/ZendFramework/bin/zf.sh /usr/bin/zf
zend
php
library
setup
install
environment
Now download the latest version of the Zend Framework
Unzip and copy the following files:
* library/Zend to /usr/local/zend/share/ZendFramework/library/Zend
* extras/library/ZendX to /usr/local/zend/share/ZendFramework/library/ZendX
* bin to /usr/local/zend/share/ZendFramework/bin
* Please note that if you don’t need the zf command line tool, and the version of the Zend Framework that came with Zend Server is up-to-date, these steps are unnecessary
Finally, link the zf.sh file so you can access it easily:
* sudo ln -s /usr/local/zend/share/ZendFramework/bin/zf.sh /usr/bin/zf
june 2010 by michaelfox
Speed Up Sites with htaccess Caching
may 2010 by michaelfox
This article shows 2 awesome ways to implement caching on your website using Apache .htaccess (httpd.conf) files on the Apache Web Server. Both methods are extremely simple to set up and will dramatically speed up your site!
apache
cache
caching
performance
htaccess
environment
config
webdev
may 2010 by michaelfox
The Ultimate Htaccess
may 2010 by michaelfox
This is not an introduction to .htaccess… This is the evolution of the best of the best .htaccess on the planet. Its changed over the years with more and better .htaccess tricks using real .htaccess example code. I add my favorite htaccess-related links and sites, results from my htaccess research, and frequently update this article.
You’ve come to the right place if you are looking to acquire mad skills for using .htaccess files.
Originally (2003) this guide was known in certain hacker circles as the Ultimate .htaccess due to the high number of powerful htaccess tricks and tips to bypass security, and the fact that many of the rewrite tricks and htaccess code examples were easy to use.
htaccess
reference
apache
config
environment
caching
security
server
php
webdev
You’ve come to the right place if you are looking to acquire mad skills for using .htaccess files.
Originally (2003) this guide was known in certain hacker circles as the Ultimate .htaccess due to the high number of powerful htaccess tricks and tips to bypass security, and the fact that many of the rewrite tricks and htaccess code examples were easy to use.
may 2010 by michaelfox
PEAR integration | Wiki | CodeIgniter
may 2010 by michaelfox
This is a tutorial how to integrate PEAR into Codeigniter by Fabian Wesner (german specialist for codeigniter )
codeigniter
pear
integration
library
environment
setup
config
php
may 2010 by michaelfox
Deploying websites with Git | News | Phil Sturgeon
may 2010 by michaelfox
Back in 2008 I wrote an article describing how you can use Subversion as a very simple deployment method from your local box, through testing environments to your live servers. Since then I have been using Git to track all client work and personal projects, so I modified this approach to work with Git.
It sounds a little crazy to some people, but really deploying websites with a version control system makes a lot of sense. When you develop on your local box you can change any number of files throughout a codebase and trying to manually remember what files have been changed can be a pain in the nadgers.
You either need to use your VCS (Subversion, Git, Mercurial, etc) to give you a list of changes files so you can manually go around re-uploading each of them, but this can take a long time on a large application.
git
deployment
live
production
workflow
vcs
versioncontrol
deploy
testing
environment
It sounds a little crazy to some people, but really deploying websites with a version control system makes a lot of sense. When you develop on your local box you can change any number of files throughout a codebase and trying to manually remember what files have been changed can be a pain in the nadgers.
You either need to use your VCS (Subversion, Git, Mercurial, etc) to give you a list of changes files so you can manually go around re-uploading each of them, but this can take a long time on a large application.
may 2010 by michaelfox
Python & Appscript Tools « Clark's Tech Blog
may 2010 by michaelfox
First download both ASTranslate and ASDictionary from the Appscript tool page. ASDictionary adds a help feature to Appscript. ASTranslate translates Applescript into Python. Both are essential if you want to script.
Next install iPython on your computer. Ignore most of the pages on iPython installation Google gives you. With recent versions of OSX Python comes with easy_install. Just type easy_install ipython at the command line and everything should get installed. If your system doesn’t have easy_install then install setuptools which includes it. (As an aside, if you’ve jailbroken your iPhone then iPython makes a wonderful calculator from the Cydia terminal)
python
applescript
mac
osx
snow
scripting
automation
asdictionary
astranslate
ipython
install
setup
config
environment
Next install iPython on your computer. Ignore most of the pages on iPython installation Google gives you. With recent versions of OSX Python comes with easy_install. Just type easy_install ipython at the command line and everything should get installed. If your system doesn’t have easy_install then install setuptools which includes it. (As an aside, if you’ve jailbroken your iPhone then iPython makes a wonderful calculator from the Cydia terminal)
may 2010 by michaelfox
related tags
*todo ⊕ admin ⊕ air ⊕ ajax ⊕ aliases ⊕ amazon ⊕ apache ⊕ apc ⊕ API ⊕ apple ⊕ applescript ⊕ apt ⊕ asdictionary ⊕ astranslate ⊕ automation ⊕ aws ⊕ bash ⊕ bbedit ⊕ bind ⊕ brew ⊕ browser ⊕ building ⊕ cache ⊕ caching ⊕ cheatsheet ⊕ cli ⊕ cocoa ⊕ code ⊕ codeigniter ⊕ command ⊕ commandline ⊕ compass ⊕ compile ⊕ compression ⊕ config ⊕ configuration ⊕ context ⊕ continuousintegration ⊕ cruisecontrol ⊕ css ⊕ ctags ⊕ customization ⊕ database ⊕ debug ⊕ debugging ⊕ default ⊕ defaults ⊕ deploy ⊕ deployment ⊕ dev ⊕ development ⊕ devops ⊕ django ⊕ dns ⊕ dock ⊕ dotfiles ⊕ dscl ⊕ ec2 ⊕ editor ⊕ energy ⊕ environment ⊖ etc ⊕ extension ⊕ firefox ⊕ framework ⊕ gist ⊕ git ⊕ github ⊕ github-regit ⊕ github-repo ⊕ gitolite ⊕ gitweb ⊕ green ⊕ gui ⊕ gzip ⊕ hacks ⊕ headers ⊕ health ⊕ homebrew ⊕ hosting ⊕ hosts ⊕ howto ⊕ htaccess ⊕ html ⊕ html5 ⊕ http ⊕ ide ⊕ ini ⊕ inspiration ⊕ inspiration:dotfiles ⊕ install ⊕ installer ⊕ integration ⊕ interactive ⊕ ipython ⊕ java ⊕ javascript ⊕ jquery ⊕ json ⊕ keybindings ⊕ keyboard ⊕ lamp ⊕ layout ⊕ lecture ⊕ library ⊕ linux ⊕ lion ⊕ list ⊕ live ⊕ local ⊕ localhost ⊕ mac ⊕ macosx ⊕ mamp ⊕ management ⊕ markdown ⊕ memcache ⊕ menu ⊕ mod_rewrite ⊕ monitoring ⊕ my.cnf ⊕ mysql ⊕ mysql.monitoring ⊕ mysql.optimization ⊕ mysql.performance ⊕ mysql.tools ⊕ mysql.tuning ⊕ netbeans ⊕ nginx ⊕ node ⊕ node.js ⊕ nodejs ⊕ objective-c ⊕ organization ⊕ os ⊕ osx ⊕ package ⊕ path ⊕ pear ⊕ pentadactyl ⊕ performance ⊕ permissions ⊕ php ⊕ php-fpm ⊕ phpsh ⊕ phpundercontrol ⊕ plants ⊕ plist ⊕ plugins ⊕ presentation ⊕ print_r ⊕ production ⊕ productivity ⊕ profile ⊕ programming ⊕ propertylist ⊕ proxy ⊕ python ⊕ rails ⊕ redis ⊕ reference ⊕ resources ⊕ rest ⊕ restful ⊕ rhino ⊕ ruby ⊕ runtime ⊕ rvm ⊕ sass ⊕ screencast ⊕ screencasts ⊕ scripting ⊕ scripts ⊕ scss ⊕ security ⊕ server ⊕ settings ⊕ setup ⊕ shell ⊕ shortcuts ⊕ snippet ⊕ snippets ⊕ snow ⊕ software ⊕ source ⊕ sources ⊕ spam ⊕ speed ⊕ spotlight ⊕ ssh ⊕ staging ⊕ stylesheets ⊕ sustainable ⊕ svn ⊕ sysadmin ⊕ system ⊕ ted ⊕ terminal ⊕ testing ⊕ textmate ⊕ tips ⊕ tools ⊕ trick ⊕ tricks ⊕ troubleshooting ⊕ tuning ⊕ turnkey ⊕ tutorial ⊕ ubuntu ⊕ unittesting ⊕ unix ⊕ userscripts ⊕ vagrant ⊕ var_dump ⊕ vcs ⊕ versioncontrol ⊕ video ⊕ vim ⊕ vimrc ⊕ virtual ⊕ virtualbox ⊕ virtualhosts ⊕ vmware ⊕ warehouse ⊕ web ⊕ webdev ⊕ wordpress ⊕ workflow ⊕ xdebug ⊕ XML ⊕ zend ⊕ zend.server ⊕ zend.serverce ⊕ zsce ⊕ zsh ⊕Copy this bookmark: