capistrano3: run gem binary

I need to setup deploy task to run eye. Tried to deal with gem-wrappers, but had no success. As capistrano3 is using non-interactive ssh, without loading user’s environment (.profile, .bashrc etc), then command, which is not in PATH, it’s not workin.

So, after searching and reading capistrano (capistrano/rvm) source, then sshkit source, I got into this simple solution.

It’s not dependent on any other settings nor knowing what, where rvm is installed.

before change in deploy.rb (not working)

after change in deploy.rb

original code from capistrano is

redis sentinel with ruby (on rails)

In the last article I introduced how to install and use redis sentinel. As I’m using ruby, I need to use this new redis configuration with ruby (on rails).

For ruby on rails use redis-sentinel gem.

Then your redis initializer will look like

You can use your redis then as usual.

When using sidekiq, configuration is pretty simple too

You can test your configuration. Run rails console and test with

if you see “”, something is probably wrong. Then try to set/get some key and check Redis.current once again.

rails + passenger + nginx maintenance mode

I need to add maintenance page to some rails app, running with passenger and nginx. Here’s some config and steps.

You just need to add static html file to app_root/public/maintenance.html – and I assume css files on /assets url.

so, here’s nginx config:

setting maintance mode is really simple – set app_root/tmp/maintenance.txt file – when escaping, just remove that file.

Need to split big SQL dump into separate databases?

I do. So I’ve written small bash script to do so. I think it’s self explanatory and does it’s job well :)

I do NOT have CREATE DATABASE in sql file, thus set to USE..

Change image in UIImageView – RubyMotion

I needed to change image in my UIImageView, but simply setting new image using myImageView.setImage didn’t work. There’s simple workaround

and now set the image

you can remove resizableImageWithCapInsets – I’m using square images to make UIImageView of any size.

Blink LED2 – LPC1769

LPCXpresso finally beaten. Installed new v5, imported all the CMSIS needed and setup brand new, my very first, MCU example code :) I’m using LPC1769 sample board from Embedded Artists.

and the same in assembler (from

Download file using AFNetwork

set your Rakefile

when downloading multiple files, use NSOperationQueue

MD5/SHA1 gem for RubyMotion

I’ve released gem for making MD5/SHA1 hashes in RubyMotion. It’s handled by small ObjC code in vendor directory. You can get this gem from my github.

Add gem 'rm-digest'  into your  Gemfile , run bundle install  and you can generate MD5/SHA1 in your application.