Create an SSL CSR and key in one command

April 8th, 2014

This little script will let you create an SSL CSR and key in one command. Be sure to change the C (country), ST (state), and L (locality) variables to fit your needs.

Call the script with the domain name you want to generate:

$ ssl.sh www.domain.com

Look deep into Ruby Hash’s

May 16th, 2013

Whoa just saw this awesome bit of code in Tire a Ruby gem for Elasticsearch:

@total = response['hits']['total'].to_i rescue nil

For so long I have been checking Ruby Hash’s like that with a nil? or exists? check after everyone.

Never again!

Quickly debug Ruby 1.9 in Rails

April 12th, 2013

There is so much old data out there about debugging in Ruby that I wanted to post a quick reminder here so I could remember the current way to do it.

So here goes… debugging in Ruby 1.9 on Rails:

In the Gemfile…
gem 'debugger', group: [:development, :test]

Then from anywhere in your code:

One quick tip as well, type in irb from the debug console to get to a Rails console. Niiice!

Found the answer on Stack Overflow.

Quickly convert Mountain Lion DMG into an ISO file

October 2nd, 2012

From the terminal, after downloading Mountain Lion from the App store:
hdiutil makehybrid -iso -hfs /Applications/Install\ OS\ X\ Mountain\ Lion.app/Contents/SharedSupport/InstallESD.dmg -o OSX-10.8.iso

Create a self-signed SSL certificate with openssl in PKCS#12 format

August 27th, 2012

Here is a quick way to create a self-signed SSL certificate with openssl and output the key/cert into PKCS#12 format. I’ve found that I’ve had to do this several times at work to get a certificate ready for a Windows machine. I got tired of looking up the procedure each time, so here goes…

# create the private key
openssl genrsa -out server.key 2048

# create a new csr
openssl req -new -key server.key -out server.csr

# sign the csr into a PEM cert file
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

# convert the PEM cert and key into a PKCS#12 file
openssl pkcs12 -export -out server.pfx -inkey server.key -in server.crt

Possibly Fix a status error 19 code on a Mitsubishi LaserVue L65-A90 TV

August 2nd, 2012

After coming back from vacation my Mitsubishi LaserVue L65-A90 TV would not start. It had a solid red LED status indicator and would not turn on.

After talking to a local technician he gave me the following steps to try:

On the TV press and hold the Menu and Input buttons for 5 seconds.

This will trigger the system to report an error code using the power LED light. It blinked once, then paused, then blinked 9 times, indicating error code 19.

He said this error code indicated that the “receiver was locked”.

He then had me do the following to unlock and restart it:

Hold Menu and Channel Up for 5 seconds. Status light turns to green for 3 seconds. Then, hold Menu and Channel Down for 5 seconds.

Seemed a lot like resetting the CMOS on a computer to me.

After that the TV is working perfectly fine! Although, he said it may not work in all cases.

Big thank you to Ultimate Audio Video in Laguna Hills, CA! They helped me fix my TV over the phone for free!

Quickly convert files to Unix or Windows line endings

April 26th, 2012

Here is a quick script that will convert all js file line endings in a folder from either Windows or Unix into Unix line endings:
find . -type f -name '*.js' -print0 | xargs -0 perl -pi -e 's/(\n|\r\n?)/\n/'

And here is the same script to convert them into Windows line endings:
find . -type f -name '*.js' -print0 | xargs -0 perl -pi -e 's/(\n|\r\n?)/\r\n/'

VMWare Workstation left mouse stops responding

June 29th, 2011

For the last couple days I’ve had a problem with VMWare Workstation v.7.1.4 build-385536 where my left mouse click suddenly stopped working in my Windows 2008 guest VM.

I finally found the problem!

When dragging and dropping text inside the guest VM I was dragging outside the VMWare container. This is what caused the problem.

To fix it so that never happens again I’ve disabled the ability to Drag & Drop from the guest. You can set this in your virtual machine settings, under Options > “Guest Isolation”.


Add “I’m Feeling Lucky” keyboard shortcut to Chrome

May 13th, 2011

I often will search Google for a keyword that I know will return the result I want in the first spot. Until now I was using Chrome to search for the keyword and then clicking on the link to go to the page.

There must be a better way!

There is!

Setup a custom search engine in Chrome like this:

  1. Click the wrench icon
  2. Click on Preferences
  3. Click on Manage Search Engines
  4. Scroll to the bottom
  5. Add a new search engine with these fields:
    1. Google Instant
    2. !
    3. http://www.google.com/search?q=%s&btnI=Im+Feeling+Lucky


Now you can do an I’m Feeling Lucky search just by hitting the exclamation point, a space, and then the keyword. Like this:

! ruby arrays

Windows 7 Drag & Drop Stops Working

April 19th, 2011

I’ve found that in Windows 7 sometimes I will randomly be unable to drag and drop files from the explorer shell.

If you ever have that problem try this to fix it:

  1. Press Ctrl+Alt+Del.
  2. Press Esc.

This worked great for me. Your results may vary!

By the way: Thanks Microsoft for yet another reason to use a Mac instead of a PC.

Source: superuser.com