Wednesday, January 31, 2007

Complicity in Murder

This would have been more topical awhile back, but considering 
Saddam Hussein's execution is still in very recent memory it is 
worth remembering that the United States government has long been aware of the crimes that Saddam committed, and to a certain
extent complicit.  A key quote from Barry Lando:
The US gave satellite information, more to the Iraqis, enabling them to target Iranian troop concentrations, even though the US knew that the Iraqis were using chemical weapons.

Follow the link for an enlightening interview with a former 60 Minutes producer.

Monday, January 22, 2007

SSH Public Key Authentication

SSH Public Key Authentication
(password-less SSH authentication on *nix systems)

Its a pain to enter in passwords all day. If you are like me and have a dozen or more machines and accounts to maintain, password management gets ridiculous. A great solution is public key authentication. You create a public key and a private key on a client machine, and distribute the public key to the various accounts and servers you need to access. The public key identifies you, and your private key verifies your identity. You only create your key pair once, and place your public key on all the servers you want to configure for password-less login. If you do create another new key pair on the local machine, you will again have to follow the steps for configuring the remote machines.

Keep in mind, the idea is to have a key pair for a specific local account on a specific machine. If you want to be able to use password-less login from another machine, you should create a new key pair on that machine. DON'T simply copy your key pair to another machine.

Public key authentication also makes scripted remote management possible, but thats beyond the scope of this mini-article. So let's begin:

On Local/Client Machine
# Create .ssh directory unless it already exists
mkdir ~/.ssh
cd ~/.ssh

# Create your keypair. Specifying a password will protect your private key even if the private key file is compromised. Remember, the private key file identifies you, and if that file is compromised, the server is compromised as well. Regardless of password security, set secure permissions for this file.
ssh-keygen -t dsa
chmod 600 id_dsa

# Copy your public key to the server, specifically your remote user's home directory.

# Now login to the remote machine via ssh

On Remote/Server Machine
# Create the .ssh directory unless it exists
mkdir ~/.ssh
cd ~/.ssh

# Create the authorized key file unless it already exists
touch authorized_keys2
chmod 600 authorized_keys2

# Append your public key to the authorized key file. Directly editing the key file is generally a bad idea. Then delete the public key file you copied to this machine.
cat ~/ >> authorized_keys2
rm ~/

You may now logout, and log back in. This time you should be automatically logged in without a password prompt.

If you mess up, or your private key is compromised, there is a small amount of cleanup involved. On each of the configured servers, delete the line in the authorized_keys2 file that corresponds to your public key, and delete your local key pair as well. You can then start over.

Strip HTML Tags

It's trivial really...but regexp's are a bitch.

#!/usr/bin/ruby -n
puts $_.gsub(/<\/?[^>]*>/, "")

Sunday, January 21, 2007

Edit A Webpage in Place

This works for Firefox. Enter the following into the address bar.

javascript:document.body.contentEditable='true'; document.designMode='on'; void 0

This is an interesting hack. It is nothing of immediate utility, but combined with some other functionailty...

Thursday, January 18, 2007


A quote from today's Senate Judiciary Committee hearings.

Specter: Now wait a minute, wait a minute. The Constitution says you can't take it away except in the case of invasion or rebellion. Doesn't that mean you have the right of habeas corpus?

Gonzales: I meant by that comment that the Constitution doesn't say that every individual in the United States or every citizen has or is assured the right of habeas corpus. It doesn't say that. It simply says that the right of habeas corpus shall not be suspended.

Apparently our ATTORNEY GENERAL doesn't understand the fundamental premise of the Constitution, that ALL rights not EXPLICITLY given to the government are retained by the people.

Ruby Cheat Sheets

I found a handy ruby gem that makes reference very easy. gem install cheat to install the gem, then run cheat sheets to get a list of available cheat sheets. Run cheat cheat_name to display useful info.

Sunday, January 14, 2007

United States Activities Inside Iran?

This morning, national security advisor Stephen Hadley spoke about US engagement of Iranians aiding insurgents in Iraq.

When asked whether U.S. forces would cross into Iran to pursue those aiding Iraqi insurgents, he said: He said the priority "is what's going on inside Iraq. ... That's where we're going to deal with his problem." and, "Anytime you have questions about crossing international borders there are legal issues. ... We intend to deal with it by interdicting and disrupting activities in Iraq sponsored by Iran."

This response raises several questions as to whether the U.S. IS currently operating inside Iran. This administration has had a pattern of operating outside of established legal precedent (NSA wiretapping case, abuse of prisoners, suspension of habeas corpus, extraordinary rendition, etc, etc.), then dealing with the consequences (or lack of), later. In my mind, these aren't questions, but rather indications, but there is the cynicism and pragmatism.

Don't get me wrong, if people are assisting insurgents in killing our troops, they should be taken care of. Yet military incursions into a sovereign country against citizens of that country is an act of war, and war must be declared by Congress. Hence the "legal issues" mentioned by Mr. Hadley. Regardless, it has been apparent for some time that the administration's mind and direction are already set.

Just last Thursday, U.S. forces captured and detained 5 Iranian officials of relatively high rank. It has become obvious, that Iran is supporting at least the Shia side of the insurgency, and is establishing a political and military toehold in the power vacuum of Iraq.

War with Iran has already started. With politics, and on a small scale (on our side), soldiers. The battleground just happens to be Iraq.

Friday, January 12, 2007

Disable Low Disk Space Notification in Windows XP

1.Click Start, click Run, type regedit, and then click OK.
2.Locate and then click the following key in the registry:
3.On the Edit menu, point to New, and then click DWORD Value.
4.Type NoLowDiskSpaceChecks, and then press ENTER.
5.On the Edit menu, click Modify.
6.Type 1, and then click OK.
7. Logout.


Wednesday, January 03, 2007

Rails Development Using Vim

Rails developers fortunate enough to run OSX have raved to no end about TextMate, but what do the rest of us, being *Nix and Windows users, have available? RadRails is an EXCELLENT IDE, and I have used it almost exclusively for nearly a year now, but as an editor, like all software, it has severe limitations. It's a bit slow and too much of a memory hog for my taste, and not nearly as easy to extend as I would like.

In my experience as a Linux administrator and desktop user, I have learned to appreciate, and now love the Vi editor. Well, more accurately Vim. If you are using a GUI, Cream is an excellent set of customizations for GVim that make Vim more accessible to the new user.

To improve the state of affairs even further, there are various Ruby and Rails specific extensions and customizations that bring Vim to the point of being nearly as good, and better in some ways, than TextMate or RadRails. We're talking autocompletion, autoindention, syntax highlighting, abbreviations, and much much more. See this post (so useful to me that I mirrored it here) for how to tweak Vim for Rails development.