Convert PFX to PEM

Convert an IIS exported PFX file into a PEM, stripping out the passphrase in the process: openssl pkcs12 -in certificate.pfx -out certificate.pem -nodes
Read more →

Git: pushing & automatically deploying code changes

Do you develop code stored in git, and want to push changes out to production boxes automatically? I’ve used this method successfully plenty of times: ###Target Server On the receiving server, we first need to create a bare git repo. We then use the post-receive hook to automatically deploy changes to a working directory. In this case, the code will be deployed to /var/www/html.

Make the ‘bare’ git repo mkdir /home/app/git cd /home/app/git git –bare init # Add a hook to automatically deploy the code when updated cat << EOF > hooks/post-receive #!

Read more →

Reinventory Check_mk Hosts Based on Tag

Want to reinventory every check_mk host with a certain tag? Try the following, replacing ‘cisco’ with the tag in question: cmk -II $(cmk –list-tag cisco)
Read more →

Generate a random MAC address

Need a random MAC address quickly? With the virtinst package from Ubuntu, or the python-virtinst package in CentOS, simply do this in your code: import virtinst.util print virtinst.util.randomMAC() Or from the command line: $ echo ‘import virtinst.util; print virtinst.util.randomMAC()’ | python 00:16:3e:a7:08:18
Read more →

Graphing server metrics from the command line – sarplot

Here’s a useful tool me and colleague wrote a few years ago to graph system resource metrics (think: load, cpu, memory, swap, io, etc) on the command line: https://github.com/hcooper/sarplot It only has two dependancies: sar (provided by the sysstat package), and gnuplot. Here’s an example graphing the last 24 hour’s load on a busy database box:
Read more →