Random useful stuff

Image by SP8254

Every day I find things that are insanely nice to have or useful.  These things vary from a blog post that saves me hours of abort/retry/fail to really handy utilities and fancy frameworks. It’s worth mentioning a few here.

Installing RVM on OS X

This blog post on installing RVM on OSX is very informative. The solution proposed at the end of the blog post was enough to get the XCode command line tools to install RVM. The issue with installations on OSX seems to be that their (special, one of a kind, non-standard, etc) compiler is quirky so you must trick it into being more compatible. The relevant line from the article is for the install command`:

rvm install <version> --reconfigure --debug -C --enable-pthread --with-gcc=clang

It’s actually probably worth mentioning that RVM is extremely handy.  There’s nothing worse than having to sudo to install gems or try to manage different versions of Ruby on your machine. Ruby introduces tons of breaking changes with each release, so be careful of which version you are running, particularly if you just got a book for what you thought was the latest version.

Getting alt+drag support in Windows

I love various tweaks in the window managers that are available for Linux.  One most notable feature is the ability to hold alt and drag windows.  There’s a Google code project for Alt dragging behavior that lets me work with the fancy pants window dragging behavior of my favorite Linux window mangers.

Sinatra

The first time that I started learning Ruby development, I learned Rails. I should have started with Sinatra. This simple and concise web server is extremely easy to configure and map.  The following is an example implementation of a web server implementing multiple RESTful endpoints and various web paths:

require 'sinatra'

someJson = <<-QQ
  {
    "glossary": {
        "title": "example glossary",
    "GlossDiv": {
            "title": "S",
      "GlossList": {
                "GlossEntry": {
                    "ID": "SGML",
          "SortAs": "SGML",
          "GlossTerm": "Standard Generalized Markup Language",
          "Acronym": "SGML",
          "Abbrev": "ISO 8879:1986",
          "GlossDef": {
                        "para": "A meta-markup language, used to create markup languages such as DocBook.",
            "GlossSeeAlso": ["GML", "XML"]
                    },
          "GlossSee": "markup"
                }
            }
        }
    }
  }
  QQ

get '/' do
  "Look at me now, look at me now"
end

get '/gus' do
  "I'm getting paper"
end

get '/gus.json' do
  content_type :json
  someJson
end

get '/afile' do
  send afile
end

Yeah, that’s a web server. Not until using this library had I felt there was “nothing left to take away” from such frameworks.

Revisiting a few old friends on the Unix/Linux command line

scp – copy files over ssh.  I always forget the colon on the remote server line.  The following is an example of how I move in to a new machine.

scp ~/.bash_profile user@remoteserver:~/
scp ~/.bashrc user@remoteserver:~/
scp ~/.vimrc user@remoteserver:~/

rsync – copy file differences.  This is amazingly handy when you need to copy large amounts of data over your network because when things go wrong, you can easily start off where you left off. Syntax is just like cp:

rsync -r ~/big_folder/ user@remoteserver:~/

ssh -X – tunnel X11 over SSH.  I don’t use graphical programs remotely, but when I do, I tunnel over ssh.  This is rarely useful because remotely running X is slow and miserable, but sometimes you just gotta and it’s nice to know.

ssh -X <remoteserver>

Odds and ends

But wait, there’s more!  A few odds and ends:

That’s all, folks, thanks for reading 🙂  Please feel free to share if you have any newish favorite things you’ve found out about.