Matthew Hutchinson

about

Matt is a web developer from N. Ireland. He currently runs Hiddenloop and works in Dublin. Want to find out just a little bit more ?

An audio feed is available for the latest articles at matthewhutchinson.net, find it here.

Handy Aliases (3)

posted 2 months ago

Working on the rails day in and out now, I’ve found the following aliases to come in handy;


# General Commands
alias ls='ls -al'

# TextMate, mate all of current dir and crucial rails folders only
alias et='mate . &'
alias ett='mate app config lib db public test vendor/plugins &'

# RAILS,  (run these from your rails folder)

# rails scripts
alias ss='./script/server'
alias sc='./script/console'
alias sg='./script/generate'
alias sp='./script/plugin'
alias mr='mongrel_rails start'

# rails testing 
alias att='autotest'
alias tu='rake test:units'
alias tf='rake test:functionals'    

# tail logs
alias tl='tail -f ./log/development.log'
alias tt='tail -f ./log/test.log'      

# clean the logs
alias ctl='cp /dev/null ./log/test.log'
alias cdl='cp /dev/null ./log/development.log'

I should credit Peep Code for the idea. To use, (e.g. in OSX) place the above in a ~/.bash_aliases file and in ~/.bash_profile, load it in with this command;

if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases ; fi

Also, (and before I forget it myself) – here’s a quick session cleaner command to put in your cron, (for day old, mysql session clearage action); rather than build a rake task, or extra controller to clean them out.


#!/bin/bash

cd /u/apps/matthewhutchinson.net/current
echo "<== CRON TASK ==> clear day old sessions data on matthewhutchinson.net" 
ruby script/runner -e production "ActiveRecord::Base.connection.delete(\"DELETE FROM sessions WHERE updated_at < NOW() - INTERVAL 1 DAY\")" 

3 comments, post another

Liquid error: Expected /u/apps/matthewhutchinson.net/current/config/../app/models/tagging.rb to define Tagging
  1. David Rice

    2 months ago, said;

    You may like the following too :)

    1. saa = add all unknown files (?)
    2. sdm = delete all missing files (!)
    3. srr = remove all .svn directories
    
    
        alias saa="svn status | grep "^\?" | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add" 
        alias sdm="svn status | grep "^\!" | sed -e 's/! *//' | sed -e 's/ /\ /g' | xargs svn delete" 
        alias srr="find . -name .svn -print0 | xargs -0 rm -rf" 
    
    
    

  2. matt

    2 months ago, said;

    Thanks ! will come in handy

  3. Alina

    2 months ago, said;

    Man you don’t even know how long I’ve waited for this since disabling my own Movable Type widget (that doesn’t work since Haloscan bypasses that code).

    THANK YOU!

whaadddyaa say yourself ?