rndsleep – add a random delay to cron jobs

A command-line utility written in Go to sleep for a random period, then run another command line executable.

Typical usage would be to run puppet agent in onetime mode in cron to save resources – the random sleep will help to avoid thundering herd issues at the puppetmaster.

rndsleep --randmax=30 --command="puppet agent --no-daemonize --onetime"

would run puppet agent with a random timeout of 0-30s.

Can be compiled on all platforms that Go is available for. Download it from github.

Comment-line in emacs

To comment/uncomment a line in emacs, add this to your ~/.emacs

(courtesy of Gerstmann on StackOverflow)

Using ssh agent for sudo authentication on debian

Using this ubuntu guide with 2 changes.

1. Change the configure line to

./configure --libexecdir=/lib/x86_64-linux-gnu/security/ --with-mantype=man

2. Instead of editing the sudoers file, create a file under sudoers.d (more modular):

echo "Defaults env_keep += SSH_AUTH_SOCK" > /etc/sudoers.d/ssh_auth

Also note that the latest version of this module on sourceforge is more recent than linked.

Cleaning up repos in cobbler

Here’s a cobbler snippet that disables the default repomirror (presuming you are serving the rpms yourself) and adds the updates channel

# disable Centos Base Repo (get updates elsewhere)
sed -i -e 's/^/#/g' /etc/yum.repos.d/CentOS-Base.repo
# download updates repo file
wget -O - http://$http_server/cobbler/repo_mirror/Centos6-UPDATES/config.repo > /etc/yum.repos.d/Centos6-Updates.repo
sed -i -e 's/\${http_server}/$http_server/' /etc/yum.repos.d/Centos6-Updates.repo

Change the name of the update repo to suit & include it the post section of your .ks template.

Including the update channel in the cobbler profile broke for me – and others too (freezes when it tries to install dbus).


cliget :: Add-ons for Firefox

Download files using curl or wget. This addon generates curl/wget commands that emulate the request as though it’s coming from your browser allowing you to download protected files directly to a separate machine (e.g. server).

via cliget :: Add-ons for Firefox.

Very useful for downloading ISOs directly to your server that you have to log in and traverse various forms (eg Oracle Enterprise Linux).