Using Vi with Bash and Readline Applications

June 15th, 2009

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.

Bookmark and Share

Kevin Colyar Uncategorized

Software I’m Using – February 2009 Edition

February 25th, 2009

I thought I’d post a list of software I’ve been using consistently for the last month.  I’ve broken it down to stuff I use on a day-to-day basis and on a several-times-a-week basis.  Kind of nice that I didn’t have to put Visual Studio on either list.

Every Day

Several Times a Week

Bookmark and Share

Kevin Colyar Uncategorized

Metasploit Framework

September 11th, 2008

I stumbledupon the Metasploit project last night.

“Metasploit provides useful information to people who perform penetration testing, IDS signature development, and exploit research. This project was created to provide information on exploit techniques and to create a useful resource for exploit developers and security professionals.”

Basically, it’s an exploit framework that makes it very easy to run exploits against local and remote systems with a chosen payload, such as a remote shell or reverse VNC session. It comes with a library of exploits for all sorts of OSes and software, even SCADA.

Another interesting note is that the Metasploit framework is written in ruby and has several user interfaces including a command line, gtk gui, and a Rails web interface.

http://www.metasploit.com/

Fear the Metasploit Framework

Bookmark and Share

Kevin Colyar Uncategorized

New Vim Plugins

September 10th, 2008

Some great Vim plugins I found today:

  • Autoclose: Autocloses your “, ‘, (, [, { characters like Textmate.

    Download here.

  • Surround: Nice shortcuts for working with html and xml like tags, as wells as quotes and others. Found this plugin when looking for a <%= %> macro for my Rails work. It’s <C-s>=. More specifically, go into insert-mode and hit Ctrl-s then ‘=’. Also, hit <C-s>- to start inserting text in a <% -%> block. Works great.

    Download here.

Bookmark and Share

Kevin Colyar Uncategorized

Installing xapian on Dreamhost for the rails acts_as_xapian plugin

August 18th, 2008

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.
Bookmark and Share

Kevin Colyar Uncategorized

HTTParty

July 30th, 2008

HTTParty

Check out this ruby gem to consistently and easily access web services.

Bookmark and Share

Kevin Colyar Uncategorized

Bash: cd to Last Directory

June 4th, 2008

I’ve been using bash forever and never knew about this:

$ cd -

This will let you change directory to your previous location in the file system. It’s and easy way switch back and forth between two directories.

Bookmark and Share

Kevin Colyar Uncategorized

Syncing Your SSH Keys with Ruby

June 4th, 2008
 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
Bookmark and Share

Kevin Colyar Uncategorized

Auto Export Firefox 3 Bookmarks

June 4th, 2008

As of Firefox 3, bookmarks are saved in a places.sqlite database file instead of the usual bookmarks.html file. This breaks functionality with some extensions and, more importantly, application launchers like Launchy and Find and Run Robot. To fix this, you can configure Firefox 3 to auto-export your bookmarks to your bookmarks.html file. To do this, enter about:config in your browser location bar and change the browser.bookmarks.autoExportHTML key to true. Now when you exit Firefox, your bookmarks will be written to your bookmarks.html file for your extensions and app launchers to use.

Bookmark and Share

Kevin Colyar Uncategorized

She Said YES!

December 11th, 2007

This weekend, on 12/8/07, I asked the most beautiful girl in the world to marry me and she said YES. YES!!

Here are the pictures.

Bookmark and Share

Kevin Colyar Uncategorized