Linux

Fixing Airfoil Speakers for Ubuntu

December 13th, 2009 0 Comments

Airfoil is a great piece of software that I use for playing music on all the computers and iPhones in my house.  This weekend I tried to install Airfoil speakers on the Unbuntu machine in my workshop and ran into trouble.  Long story short, I needed to replace the installed DLLs with those of the Windows client.  This works because DLLS are .NET libraries and run on Mono on Ubuntu.

I’ve packaged the DLLs here so you don’t have to find a Windows machine to install Airfoil speakers on.

Installing Ruby Oracle Libraries on Cygwin, OSX, and Linux.

July 22nd, 2009 2 Comments

A month or so ago I needed to connect a Rails site to an Oracle database from cygwin, osx, and linux (both 32 and 64 bit).

I’ve release the fruits of my labors as a collection of rakes files for each OS on github:

http://github.com/kevincolyar/ruby_oracle_libs/tree/master

Hopefully this will help someone else out.  Feel free to fork and let me know of any updates and improvements that are needed.

Using Vi with Bash and Readline Applications

June 15th, 2009 0 Comments

This weekend I came across a couple posts on Daily Vim about using vi in other applications such as bash, irb, mysql, or any other readline application.

To use vi mode for all readline applications, including bash, put the following line in your ~/.inputrc file.

set editing-mode vi

To use vi mode for bash only, put the following line in your ~/.bash_profile.

set -o vi

With these features enable, you’re dropped into insert mode and from there you can hit Esc or Ctrl-[ to change to command mode.  Enjoy.

Installing xapian on Dreamhost for the rails acts_as_xapian plugin

August 18th, 2008 5 Comments

Here is my setup:

Note: I put my custom libraries in ~/opt.
  • Step 1: Download

    Download xapian-core and xapian-binding from www.xapian.org to ~/opt/src. Untar the files.

  • Step 3: Install xapian-core

    $ cd ~/src/xapian-core directory.

    $ ./configure –prefix=$HOME/opt

    $ make

    $ make install

  • Step 4: Install xapian-bindings

    $ mkdir ~/opt/my_ruby_modules

    $ cd ~/src/xapian-bindings

    $ ./configure –with-ruby
    –prefix=$HOME/opt RUBY_LIB=$HOME/opt/my_ruby_modules RUBY_LIB_ARCH=$HOME/opt/my_ruby_modules
    $ make

    $ make install

  • Step 5: Configure your Rails site to use your modules

    In config/environment.rb:

    if RAILS_ENV == ‘production’

    config.load_paths += [ ENV['HOME'] + ‘/opt/my_ruby_modules’ ]

    end

  • Note: When you run your xapian rake tasks you’ll incorrectly get this message, “acts_as_xapian: No Ruby bindings for Xapian installed” but everything works fine.

Syncing Your SSH Keys with Ruby

June 4th, 2008 0 Comments
 1 #!/usr/bin/env ruby
 2 
 3 def sync_ssh_key
 4 
 5   # Default servers
 6   servers = ['my.server.com']
 7 
 8   # Use passed in list of servers.
 9   servers = $* unless $*.empty?
10 
11   servers.each do |server|
12     puts "---------------#{server}----------------"
13 
14     puts "Touching .ssh/authorized_keys on #{server}"
15     next unless system("ssh #{server} \"mkdir -p .ssh; touch .ssh/authorized_keys; touch .ssh/authorized_keys2\" ")
16 
17     puts "Copying public key to #{server}"
18     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys")
19     next unless system("scp ~/.ssh/id_rsa.pub #{server}:.ssh/authorized_keys2")
20 
21     puts 'Setting public key permissions'
22     next unless system("ssh #{server} \"chmod 700 .ssh; chmod 600 .ssh/authorized_keys; chmod 600 .ssh/authorized_keys2\"")
23   end
24 
25 end
26 
27 
28 sync_ssh_key if __FILE__ == $0