<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>A place to store useful snippets of code, links and other such geek stuffs.</description><title>Cardboard Box</title><generator>Tumblr (3.0; @waterwing)</generator><link>http://digital-penguin.com/</link><item><title>Examine x509 Certificate</title><description>&lt;p&gt;A quick way to examine a certificate in plain text…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;openssl x509 -text -in cert.pem&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1264121843</link><guid>http://digital-penguin.com/post/1264121843</guid><pubDate>Thu, 07 Oct 2010 16:22:51 -0400</pubDate><category>Linux</category><category>Mac</category></item><item><title>Convert Separate Key/Cert Files to a PFX</title><description>&lt;p&gt;The reverse of the process of &lt;a target="_blank" href="http://donisdone.tumblr.com/post/1222213969/convert-pfx-to-seperate-key-cert-files"&gt;extracting the key/certs from a PFX&lt;/a&gt; can be achieved via…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;openssl pkcs12 -export -in [certificate.crt] -inkey [private.key] -out [package.pfx]&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1264108604</link><guid>http://digital-penguin.com/post/1264108604</guid><pubDate>Thu, 07 Oct 2010 16:20:00 -0400</pubDate><category>Linux</category><category>Mac</category></item><item><title>Recover MySQL Root Password</title><description>&lt;p&gt;To recover the password for the root account on a MySQL server use the following steps…&lt;/p&gt;
&lt;p&gt;(Essentially, it can be done by restarting the daemon without the grant tables)&lt;/p&gt;
&lt;p&gt;1. Stop the current mysql process&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# /etc/init.d/mysql stop&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;2. Start the daemon without the grant tables&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# mysqld_safe —skip-grant-tables &amp;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;3. Login to mysql as the root user … it will have a blank password&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;mysql&gt; use mysql;&lt;/p&gt;
&lt;p&gt;mysql&gt; update user set password=PASSWORD(“newPassword”) where User=’root’;&lt;/p&gt;
&lt;p&gt;mysql&gt; flush privileges;&lt;/p&gt;
&lt;p&gt;mysql&gt; quit&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;5. Stop &amp; restart the daemon&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;# /etc/init.d/mysql stop&lt;/p&gt;
&lt;p&gt;# /etc/init.d/mysql start&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1263922657</link><guid>http://digital-penguin.com/post/1263922657</guid><pubDate>Thu, 07 Oct 2010 15:48:05 -0400</pubDate></item><item><title>Content-Disposition Header</title><description>&lt;p&gt;In situations where you want a file linked to from within a website to present a ‘Save As’ dialog rather than simply displaying the content … you can inject a Content-Disposition header into the HTTP connection to prompt the browser to do so.  I recently had a situation where I was linking to an uncommon file extension through a reverse-proxy and Internet Explorer wanted to include extra URI information in the ‘Save As’ file name.  You can force the saved file name with this header as well.&lt;/p&gt;
&lt;p&gt;In PHP, the header is introduced as follows…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;header(‘Content-type: text/plain’);&lt;/p&gt;
&lt;p&gt;header(‘Content-Disposition: attachment; filename=myfile.txt’);&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1263901041</link><guid>http://digital-penguin.com/post/1263901041</guid><pubDate>Thu, 07 Oct 2010 15:44:05 -0400</pubDate></item><item><title>Upper To Lower To Upper Case Command Line</title><description>&lt;p&gt;Nice trick to pipe command line data through to convert it’s alpha characters to upper or lower case.&lt;/p&gt;
&lt;p&gt;From UPPER to lower…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;tr [:upper:][:lower:]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From lower to UPPER…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;tr [:lower:][:upper:]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For example…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;ls /directory | tr [:lower:][:upper:] | sort&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1263882462</link><guid>http://digital-penguin.com/post/1263882462</guid><pubDate>Thu, 07 Oct 2010 15:40:39 -0400</pubDate><category>Mac</category><category>Linux</category></item><item><title>Remote Reboot Windows XP</title><description>&lt;p&gt;Using the Remote Desktop client to connect to a Windows XP system will not provide you with the option to reboot or restart the remote machine.  This can be done from the command line however.  Open a command prompt (Start-&gt;Run-&gt;Cmd.exe) and use the command…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;shutdown -r -t 0&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;… to open a gui interface to manage the reboot …&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;shutdown -i&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1263671397</link><guid>http://digital-penguin.com/post/1263671397</guid><pubDate>Thu, 07 Oct 2010 14:58:15 -0400</pubDate><category>Windows</category></item><item><title>Enable Syntax Highlighting In VIM (vi) In Mac OSX</title><description>&lt;p&gt;To enable the syntax highlight feature of Vim (vi) on Mac OSX, edit the /usr/share/vim/vimrc file and add the “syntax on” config.  To do this from Terminal.app …&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo vi /usr/share/vim/vimrc&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;…add a new line, “syntax on” and then save and close the file.&lt;/p&gt;</description><link>http://digital-penguin.com/post/1263663517</link><guid>http://digital-penguin.com/post/1263663517</guid><pubDate>Thu, 07 Oct 2010 14:56:29 -0400</pubDate><category>Mac</category></item><item><title>Mount ISO (.iso) In Linux</title><description>&lt;p&gt;To mount an ISO (.iso) on a Linux system…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;mount -t iso9660 -o ro,loop /path/to/file.iso /path/to/mount/point&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In many cases you will &lt;em&gt;not&lt;/em&gt; have to specify the “-t iso9660” as most Linux distributions will auto detect that.  The “ro” in the “-o ro,loop” tells this system to mount the .iso read only.&lt;/p&gt;</description><link>http://digital-penguin.com/post/1263653007</link><guid>http://digital-penguin.com/post/1263653007</guid><pubDate>Thu, 07 Oct 2010 14:54:10 -0400</pubDate><category>Linux</category></item><item><title>Convert DMG To ISO &amp; ISO to DMG</title><description>&lt;p&gt;To convert a Mac .dmg to a .iso image file, open Terminal.app and then run the following command…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/filename.iso&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To convert a .iso image file to a Mac .dmg, also in Terminal.app run the following command…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;hdiutil convert /path/to/filename.iso -format UDRW -o /path/to/filename.dmg&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1263625841</link><guid>http://digital-penguin.com/post/1263625841</guid><pubDate>Thu, 07 Oct 2010 14:48:04 -0400</pubDate><category>Mac</category></item><item><title>Strip Leading Zeros In Shell</title><description>&lt;p&gt;Nice trick to strip leading zeros from an IP address at the command line (it turn 002.203.017.001 to 2.203.17.1)…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;echo 002.203.017.001 | awk &lt;span&gt;-F “.” ‘{print int($1)”.”int($2)”.”int($3)”.”int($4)}’&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1222221296</link><guid>http://digital-penguin.com/post/1222221296</guid><pubDate>Fri, 01 Oct 2010 11:29:24 -0400</pubDate><category>Linux</category><category>Mac</category></item><item><title>Convert PFX to Seperate Key/Cert Files</title><description>&lt;p&gt;Using openssl to extract key and certificate files from a .pfx&lt;/p&gt;
&lt;p&gt;To extract the private key…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;openssl pkcs12 -in [filename.pfx] -nocerts -out [private.key]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To extract the certificate…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;openssl pkcs12 -in [filename.pfx] -clcerts -nokeys -out [certificate.crt]&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To decrypt the private key…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;openssl rsa -in [private.key] -out [decrypted.key]&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1222213969</link><guid>http://digital-penguin.com/post/1222213969</guid><pubDate>Fri, 01 Oct 2010 11:27:31 -0400</pubDate><category>Mac</category><category>Linux</category><category>SSL</category></item><item><title>Symbols, Mac OSX Keyboard Shortcuts</title><description>&lt;p&gt;Mac OSX keyboard shortcut combinations for many common symbols…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;™ (trademark) = Option + 2&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;
&lt;blockquote&gt;£ (pound) = Option + 3&lt;/blockquote&gt;
&lt;blockquote&gt;¢ (cent) = Option + 4&lt;/blockquote&gt;
&lt;blockquote&gt;∞ (infinity) = Option + 5&lt;/blockquote&gt;
&lt;blockquote&gt;§ (section) = Option + 6&lt;/blockquote&gt;
&lt;blockquote&gt;¶ (paragraph) = Option + 7&lt;/blockquote&gt;
&lt;blockquote&gt;• (dot) = Option + 8&lt;/blockquote&gt;
&lt;blockquote&gt;€ (euro) = Shift + Option + 2&lt;/blockquote&gt;
&lt;blockquote&gt;° (degree) = Shift + Option + 8&lt;/blockquote&gt;
&lt;blockquote&gt;¥ (yen) = Option + y&lt;/blockquote&gt;
&lt;blockquote&gt;÷ (division) = Option + /&lt;/blockquote&gt;
&lt;blockquote&gt;± (plus/minus) = Option + =&lt;/blockquote&gt;
&lt;blockquote&gt;≥ (greater than or equal to) = Option + &gt;&lt;/blockquote&gt;
&lt;blockquote&gt;≤ (less than or equal to) = Option + &lt;&lt;/blockquote&gt;
&lt;blockquote&gt;√ (square root) = Option + v&lt;/blockquote&gt;
&lt;blockquote&gt;π (pi) = Option + p&lt;/blockquote&gt;
&lt;blockquote&gt;≈ (approx.) = Option + x&lt;/blockquote&gt;
&lt;blockquote&gt;∆ (delta) = Option + j&lt;/blockquote&gt;
&lt;blockquote&gt;∑ (sum) = Option + w&lt;/blockquote&gt;
&lt;blockquote&gt;Ω (ohm) = Option + z&lt;/blockquote&gt;
&lt;blockquote&gt;µ (micro) = Option + m&lt;/blockquote&gt;
&lt;blockquote&gt;© (copyright) = Option + g&lt;/blockquote&gt;
&lt;blockquote&gt;® (registered) = Option + r&lt;/blockquote&gt;
&lt;blockquote&gt;† (dagger) = Option + t&lt;/blockquote&gt;
&lt;/span&gt;&lt;/p&gt;</description><link>http://digital-penguin.com/post/1222189750</link><guid>http://digital-penguin.com/post/1222189750</guid><pubDate>Fri, 01 Oct 2010 11:21:08 -0400</pubDate><category>Mac</category></item><item><title>HTTP(S) PUT w/Basic Authentiation via Curl</title><description>&lt;p&gt;Need to use a secure HTTP PUT over SSL using Basic Auth?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;curl -T file.txt -u https://[hostname]/[uri]&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Add a -v to see that connection with verbose output.&lt;/p&gt;</description><link>http://digital-penguin.com/post/1222182483</link><guid>http://digital-penguin.com/post/1222182483</guid><pubDate>Fri, 01 Oct 2010 11:19:14 -0400</pubDate><category>Linux</category><category>Mac</category></item><item><title>Flush DNS Cache, Mac OSX</title><description>&lt;p&gt;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…&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;dscacheutil -flushcache&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1221885701</link><guid>http://digital-penguin.com/post/1221885701</guid><pubDate>Fri, 01 Oct 2010 10:01:45 -0400</pubDate><category>Mac</category></item><item><title>Home &amp; End Keys, Mac OSX</title><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Remap the keys in Terminal-&gt;Preferences-&gt;Settings-&gt;Keyboard to the following…&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;End: ctrl+[, [, 4, ~ it should look like this: \033[4~&lt;/p&gt;
&lt;p&gt;Home: ctrl+[, [, 1, ~ it should look like this \033[1~&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1216979351</link><guid>http://digital-penguin.com/post/1216979351</guid><pubDate>Thu, 30 Sep 2010 15:49:47 -0400</pubDate><category>Mac</category></item><item><title>URL Encode/Decode (Perl)</title><description>&lt;p&gt;Snippet of Perl code to URL encode/decode a string…&lt;/p&gt;

&lt;p&gt;URL Encode:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;$str =~ s/([^A-Za-z0-9])/sprintf(“%%%02X”, ord($1))/seg;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;span&gt;&lt;span&gt;URL Decode:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;$str =~ s/\%([A-Fa-f0-9]{2})/pack(‘C’, hex($1))/seg;&lt;/span&gt;&lt;br/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://digital-penguin.com/post/1216947641</link><guid>http://digital-penguin.com/post/1216947641</guid><pubDate>Thu, 30 Sep 2010 15:43:27 -0400</pubDate><category>Perl</category></item></channel></rss>

