Partial solar eclipse

The view from Salt Lake City…

solareclipse

 

Error/Fix: “Decryption failed” when importing a p12 certificate into Kleopatra

Error: An error occurred while trying to import the certificate /path/to/cert.p12:
Decryption failed
snapshot3

Fix: import it from the command line with:
openssl pkcs12 -in cert.p12 | gpgsm –import
gpgsm –call-protect-tool –p12-import –store -P password cert.p12

Run a shell script with setuid

Linux has protections in place to prevent you from running shell scripts with root permissions that have the setuid bit set.
But there’s a way to work around that. (yay! but also be careful!)
You’ll need to create a binary with setuid on it…. Here’s how to create the binary:

Create the your C file (somefile.c)

#include 
#include 
#include 
#include 
int main()
{
   setuid( 0 );
   system( "/yourpath/to/yourscript.bash" );
   return 0;
}

Compile it:
gcc somefile.c -o somefile

Set permissions on it:
chown root:root somefile
chmod 4755 somefile

Error/Fix: OOM (out of memory) killer kills mysqld every time!

Error (or undesired behavior, in this case): Out of Memory killer kills mysqld when memory runs low. I’d rather have it kill apache processes instead.

Fix: specifically exclude OOM from killing the mysqld process with:
echo -17 > /proc/`cat /var/run/mysqld/mysqld.pid`/oom_adj

Error/Fix: Error: Invalid Private Key with Amazon ELB

When setting up an Amazon Elastic Load Balancer (ELB) with SSL:

Error: “Error: Invalid Private Key” when attempting to upload your keyfile to Amazon EC2

Fix:

Convert the key to a format that ELB likes with the command:

openssl rsa -in somekeyfile.key -outform PEM

edit: I got this message today “Error: Unable to parse certificate.” when I was adding a new SSL certificate for a loadbalancer. It turned out to be my key. The command above fixed it.

AWS customer service

I must admit I’m a bit surprised. This morning, I tweeted about a DNS issues I was seeing on some EC2 instances (which turned out to be a Godaddy problem)
Amazon responded to my tweet by opening up a support case:
Hello,
I am sorry to hear that you are having issues with DNS Services, Can you please let us know what issues you are seeing so we can resolve this for you.
Best regards,
Amazon Web Services

I must admit, I’m surprised and impressed. Good job AWS!

vi: change all uppercase to lowercase (and vice-versa)

It’s easy to change from uppercase to lowercase in vi!
:%s/.*/\L&/

or to change from lowercase to uppercase
:%s/.*/\U&/

Raspberry Pi case made from cardboard, cardstock, paper or plastic

A few months ago I designed a case for my Raspberry Pi that I could cut out of cardstock with a Silhouette Cameo.

img_3670

(this case is cut out of an overhead projector slide)

 

It was inspired by the Punnet case.  Except I wanted something that didn’t require glue to assemble and was a little more compact.

img_3664

Punnet case (bottom), rev1 (middle), current design (top)

 

The Silhouette file is downloadable from my raspberry-pi-case github project.

pi-layout

I’d like to change the vent in the top to be a raspberry, but haven’t had the time to make that change yet.

 

 

Remove a stuck DVD/CD from a MacBook Pro

So, I burn a fresh CD in my MacBook Pro and it gets stuck. When I hit the eject key, it tries to come out but only pokes out a couple of millimeters before getting sucked back in.
Searching all over the internet, Mac users were useless for helping me. Everyone suggested alternate ways to eject the disc (push the eject key, command-E, drag the disc to the trash, hold down the mouse button on boot) ignoring the fact that it may be physically stuck.

Then I found the solution (queue the angelic choir)

*** Do this at your own risk. It worked the first time for me but I take no responsibility for you doing something stupid and messing up your laptop. ***

There are two levers on a slot-loading CD/DVD drive that help center a CD/DVD disc. Some CDs and DVDs have an uneven edge which can cause enough friction to prevent the disc from ejecting.
If this happens follow these steps:

1. Take a large paperclip and grasp it with one hand so that about three quarters of an inch, or 18 millimeters, extends beyond your fingers. Insert the paperclip into the CD/DVD slot about 1.5 inches, or 36 millimeters, from the left edge of the slot.
2. With the other hand, push the eject key on the keyboard to eject the disc. When you hear the disc attempt to eject, slide the paperclip to the left edge of the slot and then remove the paperclip. You should feel a little resistance from the spring loaded centering lever.
3. Once the disc has been successfully ejected, wipe the outside edge of the CD/DVD with your hands. Cleaning the edge of the disc in this way will reduce the likelihood of the disc becoming stuck again.

 

Error/Fix: ‘SSLv2_method’ undeclared here (not in a function)

When building ruby 1.9.2 on Ubuntu 11.10
Error:
ossl_ssl.c:110:1: error: ‘SSLv2_method’ undeclared here (not in a function)
ossl_ssl.c:111:1: error: ‘SSLv2_server_method’ undeclared here (not in a function)
ossl_ssl.c:112:1: error: ‘SSLv2_client_method’ undeclared here (not in a function)
make[1]: *** [ossl_ssl.o] Error 1
make[1]: Leaving directory `/home/username/.rvm/src/ruby-1.9.2-p180/ext/openssl’
make: *** [mkmain.sh] Error 1

Fix:
rvm pkg install openssl
rvm install ruby-1.9.2-p180 –with-openssl-dir=$rvm_path/usr

Go to Top