Skip to content

Instantly share code, notes, and snippets.

@mshock
mshock / ppm_getmods.pl
Created October 11, 2012 20:50
ppm install missing modules from exported csv
#! perl -w
# read exported ppm csv list and install all missing modules
use strict;
# first make sure everything is up to date
print "updating all installed modules...\n";
print `ppm upgrade --install`;
print "\ndone\n\n";
@mshock
mshock / ppm_list.csv
Last active October 11, 2015 11:57
workstation ppm list @ 2/26/2013
name version files size area
ANSIColor 3.00 0 0 perl
ActivePerl-CPAN-Config 1.0 2 1900 perl
ActivePerl-Config 1.3 2 17865 perl
ActivePerl-DocTools 2.4 13 63474 perl
ActivePerl-IIS-Config 1.0 0 0 perl
ActivePerl-PPM 4.14 64 622271 perl
ActiveState-PerlCritic 10.0 24 191887 perl
ActiveState-RelocateTree 1.4 4 29505 perl
ActiveState-Scineplex 1.1 7 86307 perl
@mshock
mshock / reconst_truth.pl
Created October 8, 2012 20:42
regex truth constant
# useful to implement in many scripts that need to verify user input from CLI or config files
use constant REGEX_TRUE => qr/^\s*(?:true|(?:t)|(?:y)|yes|(?:1))\s*$/i;
@mshock
mshock / tab.pl
Created May 15, 2012 15:18
shell tab emulation
#! /usr/bin/perl -w
use Term::ReadKey;
# make STDOUT hot
$| = 1;
$string = '';
$done = 0;
# get your dir listing
opendir($dh, '.');
@mshock
mshock / restart_services.pl
Created May 15, 2012 14:55
restart Windows services
# /usr/bin/perl
# child process to background
# poll windows services and re-enable + start them
use Win32::Service;
use Win32::OLE;
use strict;
# set logfile location
my $logfile = 'log.txt';