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
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
exists? check after everyone.
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.
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
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
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!
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/'
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”.
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!
Setup a custom search engine in Chrome like this:
- Click the wrench icon
- Click on Preferences
- Click on Manage Search Engines
- Scroll to the bottom
- Add a new search engine with these fields:
- Google Instant
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
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:
- Press Ctrl+Alt+Del.
- 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.