Bryan Pearson Consulting - Blog: Thoughts on photography, web development/design, and other random things.

OS X Terminal: Fix Home, End, Page Up, Page Down Keys

February 12, 2010 at 12:36 pm

I love my MacBook Pro, but I can’t stand the fact that when I SSH to a Linux machine, my default Terminal App keyboard actions are all wonky. I can get through the couple of hours with a new laptop, but then I start to clinch my jaw when I need navigate through a Nano’d file. Next, I start pulling my hair when I’m stuck in a remote server with no backspace. It’s awful.

But there is a solution! Follow the instructions below of fix your OS X Terminal App so that it works well almost everywhere.

Open Terminal App, open the Preferences, go to Settings and select the profile you want to modify, then select Keyboard . Change the value of of the Home, End, Page Up and Page Down keys to the following:

End : \005
Home : \001
Page Up : \033[5~
Page Up : \033[6~

And those will, for the most part, get you where you need to be as far as your Terminal keyboard settings go.

One note: I still can’t get the Terminal App to work properly inside of a Screen session on a remote Linux machine. I will post an update when I find a fix.

Changing OS X Default Hibernate Modes

February 2, 2010 at 1:25 pm

If you are as troubled as I was about why your new MacBook or MacBook Pro take so long to go to sleep once the lid is closed, I have a solution for you.

By default, Apple ships all of their portable computers with the “Safe Sleep” option turned on. With this option set, when you close the lid of your shiny new laptop, it can often take between 15 seconds to 1 minute to copy the contents of your RAM to your Hard-Disk. ‘Safe Sleep’ may be more robust in the case of a complete battery failure, or allow one to swap their battery without powering down the laptop, but come on. Do I really need that?

I won’t go into the details of why copying the content of your RAM to a static medium is insecure (Passwords, sessions, etc.). The real problem for me was that when I close the lid of my laptop, I want it to sleep. Period.

When I’m at the DMV, shlepping my elderly grandma/loved-one/creepy-decrepit-neighbor to get their licence renewed even though they shouldn’t be driving, I need to be able to slam the lid of my MacBook Pro and have it instantly go to sleep. I shouldn’t be worried about damaging the hard drive as I’m throwing the laptop in my shoulder back, gearing up for DMV-line battles.

So, without further ranting, the fix. Run the following commands.

sudo pmset -a hibernatemode 0
sudo nvram "use-nvramrc?"=false

Side note: To put the computer back into ’safe sleep’ mode, change the ‘0′ to a ‘3′, and the ‘false’ to ‘true’, and run the commands again.

Next, to clear up some hard drive space, remove the now unused ’sleepimage’ file from your hard drive. In my case, removing the file saved me 8GB of precious hard-disk space.

sudo rm /private/var/vm/sleepimage

That should be it! Enjoy your new, faster Apple portable.

10 tips for a new django developer

January 31, 2010 at 8:35 am

The 0&1 Posterous blog had a fantastic post about some tips that all new Django developers should know about.

Top 10 tips for a new django developer

List column names of a PostgreSQL database

January 24, 2010 at 8:57 pm

This might seem like a basic thing to post about, but it’s a handy thing to have in your arsenal.

The following command will list all of the column names in a given PostgreSQL database table.

1
2
3
SELECT column_name
  FROM information_schema.COLUMNS
  WHERE table_name = 'tablename';

New Django powered ‘code.bryanpearson.com’ site is up

January 1, 2010 at 4:28 pm

I’ve been working on some places to store and host all of the little projects that I create for a while now. I could never find quite the right place to put them. I would start one one thing, and not like it. I would start on another, and find that it didn’t quite live up to my expectations, or was too complicated for what I needed.

So recently, I signed up for a new Virtual Server with Linode ( http://linode.com ), installed Django ( http://djangoproject.com ), and started hacking. I’ve been a huge Django fan and developer for a while, so it only made sense for me to develop my new playground in Django.

Check it out at https://code.bryanpearson.com

I think this time I’ve got just the right amount of power, and simplicity for my needs. And it’s using Django, so you can’t beat that.

Up on code.bryanpearson.com , I will post projects and code I am currently working on, have some of my publicly available utilities (such as my password-helper), and in general try to keep my coding skills developed and honed.

Don’t tread on me

August 15, 2008 at 8:15 am



Don’t tread on me, originally uploaded by bryanpearson.

It will never stop

August 15, 2008 at 8:14 am



It will never stop, originally uploaded by bryanpearson.

By the wayside

August 15, 2008 at 8:14 am



By the wayside, originally uploaded by bryanpearson.

View from the bottom

August 15, 2008 at 8:11 am



View from the bottom, originally uploaded by bryanpearson.

At a days end

August 4, 2008 at 8:30 am



At a days end, originally uploaded by bryanpearson.

Find us on:

Services offered: