I want to kill all of my processes with the name resque in them. Here is a command that will do that for me.
kill -9 `ps -ef | grep resque | grep -v grep | awk '{print $2}'`
Helpful hints and my personal findings as technology changes in the mobile and web app space.
Tuesday, February 21, 2012
Saturday, January 28, 2012
Ubuntu 11.10, rbenv, ree 1.8.7 installation
I wanted to get away from rvm and start using rbenv. As of January 2012, there were some issues with installing ree on ubuntu 11.10 because of the openssl v2 issue found here. Here is how I set up my machine and with good success:
1) Remove all traces of rvm from my system:
sudo apt-get remove rvm-ruby
clean up my .bashrc (.bash_profile if that's you) to remove rvm
2) Install rbenv and ruby-build
3) Install ree. Now the trick to getting around the openssl issue here is not to use ree-1.8.7-2011.03 but to use ree-1.8.7-2011.12 instead:
ruby-build ree-1.8.7-2011.12
4) Set up my local environment using ~/.bash_profile Here is what I put in mine:
export GEM_HOME="$HOME/.localgems" # I created a ~/.localgems directory
export PATH="$HOME/.rbenv/bin:$HOME/.localgems/bin:$PATH" # Added the rbenv binary and .localgems/bin to my path
5) Set up my rails project to use the ruby I installed using ruby-build:
cd ~/Rails/my_project
rbenv local ree-1.8.7-2011.12
You should now have a .rbenv-version file in your project directory. This translates roughly to a .rvmrc file.
6) Bundler. I want bundler to manage my project gems instead of relying on rvm gemsets. To do this, I created the bundle config file for my user:
mkdir ~/.bundle
echo 'BUNDLE_PATH: vendor/bundle' >> ~/.bundle/config
7) Source your .bash_profile:
source ~/.bash_profile
8) Install bundler. Note: you will need rubygems installed. You can use sudo apt-get install rubygems if you are using ubuntu
gem install bundler
9) Enter your project and do your bundle install
cd ~/Rails/my_project
bundle install
YAY!
1) Remove all traces of rvm from my system:
sudo apt-get remove rvm-ruby
clean up my .bashrc (.bash_profile if that's you) to remove rvm
2) Install rbenv and ruby-build
3) Install ree. Now the trick to getting around the openssl issue here is not to use ree-1.8.7-2011.03 but to use ree-1.8.7-2011.12 instead:
ruby-build ree-1.8.7-2011.12
4) Set up my local environment using ~/.bash_profile Here is what I put in mine:
export GEM_HOME="$HOME/.localgems" # I created a ~/.localgems directory
export PATH="$HOME/.rbenv/bin:$HOME/.localgems/bin:$PATH" # Added the rbenv binary and .localgems/bin to my path
5) Set up my rails project to use the ruby I installed using ruby-build:
cd ~/Rails/my_project
rbenv local ree-1.8.7-2011.12
You should now have a .rbenv-version file in your project directory. This translates roughly to a .rvmrc file.
6) Bundler. I want bundler to manage my project gems instead of relying on rvm gemsets. To do this, I created the bundle config file for my user:
mkdir ~/.bundle
echo 'BUNDLE_PATH: vendor/bundle' >> ~/.bundle/config
7) Source your .bash_profile:
source ~/.bash_profile
8) Install bundler. Note: you will need rubygems installed. You can use sudo apt-get install rubygems if you are using ubuntu
gem install bundler
9) Enter your project and do your bundle install
cd ~/Rails/my_project
bundle install
YAY!
Thursday, January 26, 2012
The SVN commands I use the most
In my svn toolbox, I reach for these the most. I hope you find them useful too.
Creating a new branch based on a pre-existing one:
svn copy
Creating a new branch based on a pre-existing one:
svn copy
Monday, January 9, 2012
Capture system call output in ruby...The easy way.
I scoured the web trying to find good examples of how to do this. There were quite a few suggestions, but none of them captured the output of this system command:
fping -C 5 -q www.example.com
In the end, I found a sure way to capture it:
f = IO.popen("date; fping -C 5 -q www.example.com 2>&1").readlines
when I call puts f:
["Mon Jan 9 01:29:22 PST 2012\n", "www.example.com : 56.61 58.85 59.06 56.91 72.41\n"]
Perfect - a nice array with my 2 command's output captured nice and neat in an array!!
Hope it helps.
fping -C 5 -q www.example.com
In the end, I found a sure way to capture it:
f = IO.popen("date; fping -C 5 -q www.example.com 2>&1").readlines
when I call puts f:
["Mon Jan 9 01:29:22 PST 2012\n", "www.example.com : 56.61 58.85 59.06 56.91 72.41\n"]
Perfect - a nice array with my 2 command's output captured nice and neat in an array!!
Hope it helps.
Saturday, January 7, 2012
Capistrano and the frustating "run rake with --trace" problem
It's a pain to run a capistrano deployment just to find out something failed - perhaps in one of your migrations. At this point, you are getting upset because --trace wasn't run and you couldn't see where the actual issue was. Never fear. Open your Rakefile and add:
Rake.application.options.trace = true
After adding that and committing, run your cap deploy again and you will see that stack trace.
YAY!
Rake.application.options.trace = true
After adding that and committing, run your cap deploy again and you will see that stack trace.
YAY!
Subscribe to:
Posts (Atom)