Jeff Roberts
RHCE #804006066322833
Vim-Fu is now iPhone and Android friendly

Check out the Vim-Fu Store!

Vim-Fu

Starting Over in VIM using e!

I haven’t posted a trick in a while, so here’s a good one to know.

Ever start working on a file in command mode and then hit the caps key without realizing it.  Wham! All sorts of un-expected things can happen before you know it.  What do you do then? You could use q! to exit without saving, then start over, but there is a more graceful way now.

Enter e!

This will rollback ALL changes to the edited file without having to exit VIM.

MySQL tuning script

This is really useful script called tuning-primer.sh by Matt Montgomery.

It is a shell script that evaluates the following parameters in MySQL:

  • slow query count
  • long_query_time
  • query_cache_size
  • % query cache actually used
  • max_connections
  • thread_cache
  • key_buffer_size
  • ratio of sort_merge operations to sorts (sort_buffer_size)
  • number of full joins
  • ratio of disk tmp tables vrs in memory tmp tables (tmp_table_size)
  • table_cache
  • ratio of table locks immediate to table locks waited
  • ratio of table scans (read_buffer_size)

To use the script add your user name and password to a [client] group in your ~/.my.cnf file

Here is a direct link: http://www.day32.com/MySQL/tuning-primer.sh

Using Screen to connect to a serial console

Not much to write about here.  You can use screen as a replacement for minicom. Who knew!?!?!  Screen will never stop amazing me with all the cool stuff that it can do.

screen /dev/ttyUSB0

To set the baud rate to 57,600:

screen /dev/ttyUSB0 57600

To enable CTS/RTS handshake:

screen /dev/ttyUSB0 57600,ctsrts

^a,k to end the session.
^a,i to check the status of the serial port.

Here is the .screenrc that I found on the Interweb and have been using for a little over a year now. I wish I knew who to give credit to.

escape ^zz
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r} (%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

It remaps the meta key from ^a to ^z so that I can still use ^a in bash to get to the beginning of the line. It also has a handy clock at the bottom of the screen. Enjoy!

Blacklisted Email in Amazon's EC2 Cloud

One of the major problems in having your systems in Amazon’s EC2 cloud is that the ip you get assigned is almost surely blacklisted with every major email blacklist  before you’ve sent a single piece of email (check for this using mxtoolbox.com).  I learned this the hard way when I started hearing the our registration and [...]

Cisco POE and Polycom phones

They just continuously flapped when ever they were powered by the 3550. Adding this line fixed the issue [...]

Cisco's DNS Rewrite - My new best friend

DNS Rewriting is a simple and elegant solution that can save you time and [...]

Bulk adding users to Google Apps Premier

My company is making a small jump from Google Apps Standard this morning to the Premier service, but because we are taking the opportunity to change the domain name, we are forced to do a migration.  This is really not a big deal compared to the mail migrations I have done in the past, in [...]

Great iPhone app for regex testing.

This is a great little utility to have on your iPhone.  It’s called Regexen and it is a tool that allows you to enter some text, and then cook up a regex that will match it.  You can then mail it out to your own email account or a co-worker.  It also has [...]

Converting from Apache to Nginx

I’ve decided to migrate Vim-Fu.com (WordPress) from Apache to Nginx for a couple of [...]

A Scalable DNS scheme for Amazon's EC2 Cloud

We are gearing up for the “next phase” release of our EC2 deployment and I’ve taken the opportunity to re-think the scheme based on my experiences over the last 8 or so months of using EC2. I have come up with something that is FAR better in my [...]