Menu Home

Lunix Lunacy

Reservoir Sampling with bash

So I have a fairly extensive .bashrc file, and one thing you might notice while scrolling through it, is that I have a whole bunch of “step-in” functions. These are functions that replicate some other command for some reason. Primarily this is because I work on both Linux and Solaris, […]

[INFO] rand: Updates made

As some of you know, I went to a bit of effort to create a script that tries as many ways as possible to generate random numbers. Some would say I went a bit too far. Overboard. So to speak. So recently I’ve been working on rewriting my passphrase generator […]

Portably(ish) generating random integers

[160309/20:49][rawiri@minty ~]$ rand -h rand – generate random positive integers Optional Arguments: -c [count. Number of numbers (Default:1)] -d [debug. Tells you which processing method is used (Default:off)] -h [help] -m [minimum number (Default:1)] -M [maximum number (Default:9223372036854775807)] TL;DR: I made a script that should generate a random integer for […]

Beating the vendor by 3 weeks

So a client has a vendor supplied python script that routinely connects to said vendor’s servers and downloads files. I won’t go into too much detail, but it’s a pretty important file transfer with far reaching financial influence, and we’ll leave it exactly at that. So, as you can guess […]

Host your own shellcheck

For those of you who don’t know, is a fantastic resource for improving your shell scripts.  When I came across it, I felt that I was a pretty good scripter.  How wrong I was.  Using shellcheck has probably been the single most influential factor on my scripting since the […]

Mass-diffing files

As part of my day to day tasks, I’m auditing configuration files and tidying them up. Slowly, we’re moving towards standardised files and configuration management. The first requirement of this is gathering the existing config files into one place. You could do this with any of a number of tools, […]

Time limited sudo rights using at

From time to time, a person may require sudo rights to a particular server for a limited time. If it’s a Linux host, we can use the at scheduler and a /etc/sudoers.d conf frag to automate this. Essentially, we use at to automatically remove the conf frag when the user’s […]