Skip to content

Instantly share code, notes, and snippets.

View robrwo's full-sized avatar
💭
Fnorjd

Robert Rothenberg robrwo

💭
Fnorjd
View GitHub Profile
@robrwo
robrwo / random-benchmarks.pl
Created December 28, 2024 13:32
Benchmarking modules for retrieving secure random data
use v5.20;
use warnings;
use experimental qw( signatures );
use Benchmark::Dumb qw( cmpthese );
use Crypt::URandom ();
use Sys::GetRandom ();
use Sys::GetRandom::PP ();
BuiltinFunctions::ProhibitBooleanGrep
BuiltinFunctions::ProhibitStringyEval
BuiltinFunctions::ProhibitStringySplit
BuiltinFunctions::ProhibitUniversalCan
BuiltinFunctions::ProhibitUniversalIsa
ClassHierarchies::ProhibitExplicitISA
ControlStructures::ProhibitMutatingListFunctions
ControlStructures::ProhibitUnreachableCode
ErrorHandling::RequireCarping
InputOutput::ProhibitBarewordFileHandles
@robrwo
robrwo / .gitconfig
Last active March 1, 2024 09:20
Git configuration with useful aliases
[alias]
co = checkout
di = diff
st = status
sh = show
ci = commit
br = branch
cp = cherry-pick
last = show -1 HEAD
unstage = reset HEAD --
@robrwo
robrwo / puppet_config.rb
Last active November 14, 2017 10:52
Query puppet configuration from a file
module Puppet::Parser::Functions
newfunction(:puppet_config, :type => :rvalue, :doc => <<-EOS
This function queries Puppet configuration files.
*Examples:*
puppet_config('/etc/puppetlabs/installer/answers.install', 'q_install')
Will return: 'y'
@robrwo
robrwo / profile-node.sh
Last active August 29, 2015 13:56
Simple utility to profile Puppet manifests
#!/bin/bash
sudo puppet agent -t --evaltrace \
| grep --color=never 'Evaluated in \(.\+\) seconds' \
| sed -e 's/Info: \(.\+\): Evaluated in \(.\+\) seconds/\2 \1/' \
| sort -rn \
| head
@robrwo
robrwo / sync-dotfiles.sh
Last active January 2, 2016 12:19
This is a quick-and-dirty utility to synchronise dotfiles and utilities to other machines
#!/bin/bash
hostname=$1
command=`basename $0`
if [ -z "${hostname}" ]; then
echo Usage: ${command} hostname
exit 1
fi
@robrwo
robrwo / validate-yaml.pl
Created October 23, 2013 10:56
Quick and dirty YAML validator
#!/usr/bin/env perl
use v5.10.1;
use strict;
use warnings;
use Try::Tiny;
use YAML::Any qw/ LoadFile /;
@robrwo
robrwo / monit_parser.pl
Created October 8, 2013 10:59
Quick and dirty munin plugin to monitor monit status
#!/usr/bin/env perl
# This is a Perl version of the monit_parser from
# https://github.com/munin-monitoring/contrib/blob/master/plugins/monit/monit_parser
use v5.10.1;
use strict;
use warnings;
@robrwo
robrwo / json_dump.pl
Created September 17, 2013 16:34
Quick and dirty hack to dump JSON data from STDIN as a Perl data structure.
#!/usr/bin/env perl
use v5.10.1;
use strict;
use warnings;
use Data::Dump 'dump';
use JSON::MaybeXS;