> Add syntax highlighting when pasting code into Outlook 2013

Full credit goes to avbrand.com this technique. I've made some minor tweaks so it will work if you system is configured with a proxy. Remember you're using a web service (https://tohtml.com) to perform the highlighting -- so if the code is really sensitive this may not be…

> See 'return codes' from Commands Inside a Chain of Pipes (pipeline)

It can be hard to tell if everything went okay inside a chain of pipes since $? will only report the return code from the final command in the chain. Using a different variable ($PIPESTATUS) the return codes of all the commands chained together can be found. #!/bin/bash # as long…

> Track BASH script command failures or abort after N failures

Using the trap built-in signals received by a scripts (e.g. SIGINT). Using this functionality a script can also take actions based on errors. This can allow some more nuanced handling as opposed to set -e. #!/bin/bash ErrorThreshold=5 Cumulative_RC=0 ErrorCount=0 TrackErrorTrap() { ((Cumulative_RC += $?)) ((ErrorCount++)) if…

> Use sed to Insert Text Every 'n' Lines/Characters

There are a lot of overly complicated ways to insert a line after every nth line, but the simplest way I find is the following: sed '0~3 s/$/\nMy Text/g' < input.file In a file with six lines you get something like the following: Line 1 Line…

> Rename a Github Repository

Ideally make sure the remote and any clones are up to date with one another -- not essential, but there are fewer hurdles when switching the clones to the new repository name. Go to the project in question an open the " Settings" page. Change the Repository name and click on…

> Simple Free-Tier AWS EC2 Instance Setup

This is the first of a few articles detailing how to host multiple Node.js or PHP websites on a single EC2 instance. Log in to AWS, and click on EC2 Click on Launch Instance under Create Instance Select the underlying OS you'd like to use. I've chosen Amazon Linux…

> Convert an AWS instance-store AMI to an EBS backed AMI

Borrowed this from a site I had to pull up via Google's cache with some additions. I recently needed to convert an AWS instance-store AMI to an EBS backed AMI. Here’s the steps I took in order to fix that. It’s a ext3 file system in this example,…

> Check out a _link from OBS

If you're looking to edit the _link file stored in the repository underlying your OBS you can check it out with the --unexpand-link option. Otherwise you'll end up with the _service file: osc checkout --unexpand-link <Project> <Package> # or if you're already in the project's directory: osc…

> Always Display Filename with grep

The easiest way to accomplish this is if you have a relatively recent GNU version of grep. Then the -H version is available to you: printf "This\nis\a\ntest" > /tmp/grep.test grep -H 'is' /tmp/grep.test /tmp/grep.test:This /tmp/grep.test:is But if…

> Add/Remove Passphrase from Existing Private Key

If you've got a private key you're fond of that either has or lacks a passphrase(password) and you'd like to add (because you'd like to put it someplace you trust slightly less) or remove (because you're moving it someplace you trust more [really?]) it's really straight forward. To add…