1. Two Column for Loop in bash

    Posted on in programming

    I had this interesting question the other day. Someone had a file with two columns of data in it. They wanted to assign each column to a different variable and then take action using those two variables. Here's the example I wrote for them:

    IFS=$'\n';
    for LINE in $(cat …
  2. OpenSSH: Using a Bastion Host

    Posted on in System Administration

    Quick and dirty OpenSSH configlet here. If you have a set of hosts or devices that require you to first jump through a bastion host, the following will allow you to run a single ssh command:

    Host *
        ProxyCommand ssh -A <bastion_host> nc %h %p
    

    Change the Host * line to best …

  3. [Python] Socket Timeouts in urllib2

    Posted on in Programming

    Things have changed quite a lot since this post was originally written in 2016. Currently, I would recommend switching over to making asynchronous calls via aiohttp.

    One of my scripts that makes an API call has been failing silently lately. It appears that the connection is timing out, but I …

  4. Cache has broken packages, exiting

    Posted on in System Administration

    I've been getting the following error from cron.daily in my inbox lately:

    /etc/cron.daily/apt:
    Cache has broken packages, exiting
    

    That's an annoying email to get everyday. I decided I would apt-get clean and that would probably fix the problem:

    $ sudo apt-get clean
    $ sudo apt-get dist-upgrade
    Reading package …
  5. Removing a Single Line from known_hosts With sed

    Posted on in System Administration

    Ever so often, something changes on the network, and you find that your .ssh/known_hosts file has gotten out of date. Usually this happens after an upgrade or device change. You'll get the rather ominous warning that REMOTE HOST IDENTIFICATION HAS CHANGED!

    If you are confident that someone isn't doing …

  6. Bypass RBL Check in Exim

    Posted on in System Administration

    Although I do not use Exim myself, I have clients that do. Recently, we noticed that it was taking more than 20 seconds for their SMTP banner to display when initiating checks from the monitoring server. Connecting to the server locally (on any interface IP address) did not suffer the …

My Bookshelf

Reading Now

Other Stuff