Thursday, February 5, 2015

Gnu Parallel

I had never heard of this til now, but it looks like it can make some tasks in Bash much simpler/faster.

From: https://en.wikipedia.org/wiki/GNU_parallel

The idea is to convert code such as:

for x in `cat list` ; do
do_something "$x"
done | process_output


Into


cat list | parallel do_something | process_output


Another simple example someone posted on the Arch Wiki (s/printf/echo/):


printf "world\nasynchronous processing" | parallel "echo hello, {}"

hello, world
hello, asynchronous processing

Wednesday, February 4, 2015

OpenSSL: Find certificate whose CSR was generated by a given private key


It can be confusing to determine which certificate file and which private key go together if you don't know exactly what you are looking for. At least one way to determine whether a given key was used to generate the Certificate Signing Request of a given cert is to compare their modulus values (shortened/obscured by md5 hashing).




Show the value for the private key.



$ openssl rsa -noout -modulus -in private_key.key | openssl md5

(stdin)= cab197... some stuff ... c68caa2



Show the value for the cert.




$ openssl x509 -noout -modulus -in signed_cert.crt | openssl md5

(stdin)= cab197... same stuff ... c68caa2




If the values match they go together.

I got my certificates in a bunch of formats and couldn't figure out which to use, so I brute forced the solution:



$ for file in `ls *c[er][rt]` ; do echo -n $file && openssl x509 -noout -modulus -in $file | openssl md5 ; done
some_file.crt (stdin)= cab197... c68caa2

other_file.cer (stdin)= 2241f7... D08923

...

Convert ide bus to virtio in Windows guests on Proxmox

Surprisingly simple to do this:


This is the exact procedure from http://forum.proxmox.com/threads/5248-Is-it-possible-to-convert-to-Virtio:

With "BUS" you mean IDE I suppose. Yes, it's possible, just you could risk that Win2008 ask you for a reactivation (hardware change can trigger it).
Sure on the wiki you find the answer, that is the same way you usually follow when installing as Virtio from the beginning.
In short, shutdown Win2008 and simply add a very small HD (like 1GB) with Virtio type to your Win2008 guest from web interface, and have the cdrom pointing to the ISO with the virtio drivers for kvm (latest and greatests, virtio-win-1.1.11-0.iso at the moment, see http://alt.fedoraproject.org/pub/alt...st/images/bin/).
Boot Win2008 that will detect the new 1GB HD and ask you for drivers. Install them (the ones in P { margin-bottom: 0cm; }'Wlh' dir on the .iso) and shutdown. Remove the additional hd AND your current HD (will be listed beyond as unused HD), and then re-add it picking it from the unused section, but this time with VIRTIO interface. Boot the VM and enjoy!
Of course, I don't take resposability for the success of the above, so do a backup first, just in case...


By the way, we have a VSphere setup here now, I have been messing with it for a week and it is HORRENDOUS by comparison to Proxmox as far as ease of use and administration. The interface is the most unintuitive jumbled unorganized thing I have ever seen. Now I grant you that I am still new at it, but things that are SO obvious on proxmox are either difficult or impossible on VCenter.
There are many different interfaces for doing the same things, some options are allowed some places not others, its really confusing.

Tuesday, February 3, 2015

Copy contact between address books in Thunderbird

There is NO WAY to do this via menus, right clicks etc... that I have found. But there is a secret means I found:

"Hold down the Ctrl key at the same time as you drag and drop the contact record from one book to another in order to copy rather than move the data."

Thank you to http://forums.mozillazine.org/viewtopic.php?f=39&t=1970171