Convert PFX to Seperate Key/Cert Files

Using openssl to extract key and certificate files from a .pfx

To extract the private key…

openssl pkcs12 -in [filename.pfx] -nocerts -out [private.key]

To extract the certificate…

openssl pkcs12 -in [filename.pfx] -clcerts -nokeys -out [certificate.crt]

To decrypt the private key…

openssl rsa -in [private.key] -out [decrypted.key]

Symbols, Mac OSX Keyboard Shortcuts

Mac OSX keyboard shortcut combinations for many common symbols…

™ (trademark) = Option + 2

£ (pound) = Option + 3
¢ (cent) = Option + 4
∞ (infinity) = Option + 5
§ (section) = Option + 6
¶ (paragraph) = Option + 7
• (dot) = Option + 8
€ (euro) = Shift + Option + 2
° (degree) = Shift + Option + 8
¥ (yen) = Option + y
÷ (division) = Option + /
± (plus/minus) = Option + =
≥ (greater than or equal to) = Option + >
≤ (less than or equal to) = Option + <
√ (square root) = Option + v
π (pi) = Option + p
≈ (approx.) = Option + x
∆ (delta) = Option + j
∑ (sum) = Option + w
Ω (ohm) = Option + z
µ (micro) = Option + m
© (copyright) = Option + g
® (registered) = Option + r
† (dagger) = Option + t

HTTP(S) PUT w/Basic Authentiation via Curl

Need to use a secure HTTP PUT over SSL using Basic Auth?

curl -T file.txt -u https://[hostname]/[uri]

Add a -v to see that connection with verbose output.

Flush DNS Cache, Mac OSX

As a DNS admin, I frequently need to flush my local DNS cache in order to confirm that a change I made on a DNS server was correct.  To do this on Mac OSX, open your Terminal.app and run the following command…

dscacheutil -flushcache

Home & End Keys, Mac OSX

Using Terminal.app on Mac OSX to connect to a Linux/*nix system and work in any text editor (such as Vim) is a bit of a hassle when you are used to the Home and End keys going to beginning or end of line on other systems.

Remap the keys in Terminal->Preferences->Settings->Keyboard to the following…

End: ctrl+[, [, 4, ~ it should look like this: \033[4~

Home: ctrl+[, [, 1, ~ it should look like this \033[1~

URL Encode/Decode (Perl)

Snippet of Perl code to URL encode/decode a string…

URL Encode:

$str =~ s/([^A-Za-z0-9])/sprintf(“%%%02X”, ord($1))/seg;

URL Decode:

$str =~ s/\%([A-Fa-f0-9]{2})/pack(‘C’, hex($1))/seg;