A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Ping a host, then sleep and loop in Windows

@echo off
for /L %%a in (1,1,2016) do (
date /t
time /t
ping -n 30 yahoo.co.uk
ping localhost -n 360 > nul
)

Pipe this into a file to test your internet connection.
It pings yahoo.co.uk 30 times, then sleeps for 5 minutes.
It repeats 2016 times; That is one week.

Using a custom Apache config

apachectl -f ~/httpd/conf/httpd.conf -k graceful

tail -f ~/httpd/logs/error_log

Select fields from a hashref in Perl

my @wanted_fields = qw/link id title image/;
my %display_fields;
@display_fields{@wanted_fields} = @{ %{$thing->to_hashref} }{@wanted_fields};