Archive for the ‘Computers’ Category

Use SSH to get tail of log file

Wednesday, July 14th, 2010

Ever wanted to take the last 1000 lines of a log file from your remote server and then copy that to your local machine to use in a nicer text editor?

Now you can! This single command will grab the last X lines from a remote file, remove any ANSI color codes, and then compress the output right on to your local computer.

Just replace the green text with your information and you’re all set.

ssh username@my.server.com "tail -n 3000 /var/log/mylogfile.log | sed -r 's/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g' | bzip2" > /my/local/file.log.bz2

The log will be trimmed, cleaned, and compressed all on the remote server before transport.

Ruby RVM Rocks!

Friday, April 23rd, 2010

I just now got around to installing RVM on my Mac. I wish I had done it a lot sooner!

RVM let’s you install multiple Ruby versions side by side. You can easily install a new ruby version just by typing:

rvm install ruby-1.8.7-p160

or

rvm install 1.9.2-preview1

And you can quickly switch between versions by typing this:

rvm ruby-1.8.7-p249

Note that you will need to install gems independantly in each of your ruby environments. But they make it easy with gemsets. Also note, that if you want to preserve your custom ENV settings on your Mac, you should place the bash source line into your .profile file and not to .bashrc as it notes.

Have fun!

Holy Optimizations Batman!

Saturday, February 20th, 2010

I previously published a Ruby script that essentially duplicates an Amazon S3 bucket. I use it to copy my production bucket into a testing bucket that I can then use in my staging environment, without fear of killing off something important.

Hydra, the multithreaded fire breather
Hydra, the multithreaded fire breather

Anyway, this script used to take around 18 minutes to complete a full copy of a bucket with about 2,000 keys. What a pain when I had to run this script multiple times for some testing!

So I finally got around to rewriting it today, and wow, what an improvement!

I upgraded the delete and copy operations to run multithreaded, and boy does it fly.

On my main bucket (with about 2,000 keys) it now only takes about 1.5 minutes to complete! That’s 12x faster than it used to be!

So if you are looking for a multithreaded Amazon S3 bucket copier or duplicator, check it out!

New rubygem: ianneub-right_aws

Tuesday, April 7th, 2009

Continuing my new trend of publishing code that I use, I’ve released a new fork of RightScale’s right_aws ruby gem. This gem makes accessing Amazon’s S3, EC2, and other web services a piece of cake through ruby.

One problem with (at least) the latest release of right_aws is that it tries to connect to the Amazon API at the bucket_name.s3.amazonaws.com. This causes the connections to the API to thrash when you are working with more than one bucket. I’ve taken out the code that makes that connection so that it will now only connect to s3.amazonaws.com/bucket_name by default.

You can find the code on GitHub. And see extra documentaion here.

S3 Ruby Tools

Tuesday, February 3rd, 2009

I just published some more code on github today. This new repo contains some ruby code that I use to manipulate my Amazon S3 buckets.

Right now there are just two simple scripts, one deletes a whole bucket, the other copies everything from one bucket to another, with an optional prefix to limit what is copied.

I’ve been using these scripts for a few months now, they are very stable and do some basic error handling.

Here is the README file.AWS Logo

How to change the timezone on Ubuntu from the command line

Wednesday, July 30th, 2008

I just thought I’d post this quick tidbit on how to change the timezone on a Ubuntu server after is has been installed. Simply rerun the timezone configuration:

sudo dpkg-reconfigure tzdata

phpBackupS3

Monday, July 28th, 2008

I’ve just published my PHP backup script to github.com. If you are looking for an easy to use, PHP based backup script to send things to S3, check it out.

Download the source at github.

It’s been in production for over a year at various sites. Works fine for me.

Here is the feature list:

  • Simple to use
  • Backups all databases on a MySQL server
  • Backups and compresses (using bzip2) directories and files
  • Uses URL type storage keys, so it’s easy to browse the backup bucket
  • (optionally) Removes old backups according to a grandfather-father-son based schedule

Disabling Time Synchronization in VMware Fusion

Tuesday, June 17th, 2008

I’ve been trying to figure out how to disable time/clock synchronization in a VMware Fusion guest for the past few months, and I finally stumbled upon the answer! This will prevent the VMware Fusion guest from getting the correct time from the host OS on boot or restore.

The following lines need to be added to the .vmx file inside the virtual machine package:

tools.syncTime = "FALSE"
time.synchronize.continue = "FALSE"
time.synchronize.restore = "FALSE"
time.synchronize.resume.disk = "FALSE"
time.synchronize.shrink = "FALSE"
time.synchronize.tools.startup = "FALSE"

VMware KB #1189

3G iPhone let down

Monday, June 9th, 2008

Apple announced the 3G iPhone today. It’s a pretty small feature enhancement, only three new things:

  • 3g Network
  • GPS built in
  • $200 for 8gb, $300 for 16gb

I think the best upgrade is the price. I was hoping for a lot more I guess, because that just doesn’t seem all that exciting. There are still a bunch of holes:

  • No MMS support
  • No stereo Bluetooth
  • No video recording support

They basically just changed the chipset inside and called it a day. Whoopie.

UPDATE: The price is not cheaper in the long run, it’s a lot more expensive. The new iPhone 3G plan will cost me $75/mo, compared to $60/mo for the original. That means I would end up spending $160 more for the new iPhone over 2 years, versus the original.

Is twitter ever working?

Friday, May 30th, 2008

After noticing some trouble with the twitter feed on ianneubert.com, I checked the site: istwitterdown.com and guess what it said?

I’m really tired of twitter being down all the time. I probably won’t be using it much longer. :(