Skip to content

Instantly share code, notes, and snippets.

@spicyjack
spicyjack / pigfind.sh
Last active December 20, 2015 13:49
Shell function to find the "pigs", or large directories underneath the current directory, or a directory of your choice
function pigfind {
if [ "x$1" != "x" ]; then
FIND_PATH="$1"
else
FIND_PATH="."
fi
find $FIND_PATH -maxdepth 1 -type d -exec du -sh '{}' \; 2>/dev/null \
| sort -h
} # get the sizes of the subdirectories of $PWD, sort from smallest to largest
@spicyjack
spicyjack / homebrew-enable_introspection.06Aug2013.diff
Created August 23, 2013 05:45
Homebrew: enable object introspection in ATK/Gdk-Pixbuf/GTK+3/Pango
diff --git a/Library/Formula/atk.rb b/Library/Formula/atk.rb
index 74ac570..d594d47 100644
--- a/Library/Formula/atk.rb
+++ b/Library/Formula/atk.rb
@@ -15,7 +15,7 @@ class Atk < Formula
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
- "--enable-introspection=no"
+ "--enable-introspection=yes"
@spicyjack
spicyjack / net_jenkins-jenkins_version_from_http_headers.diff
Created August 28, 2013 03:26
Patch to Net::Jenkins to get the Jenkins server version after an API request
diff --git a/lib/Net/Jenkins.pm b/lib/Net/Jenkins.pm
index 5126b1b..c8b9eeb 100644
--- a/lib/Net/Jenkins.pm
+++ b/lib/Net/Jenkins.pm
@@ -36,25 +36,41 @@ has user_agent => (
default => sub { return LWP::UserAgent->new; },
);
+has jenkins_version => (
+ is => 'rw',
@spicyjack
spicyjack / download_viewer.sh
Last active December 22, 2015 13:28
download_viewer.sh - download a JSON file using an API request (Doomworld in this case), then pretty print to JSON or YAML using JSON::XS, and pipe to vim for syntax highlighting. JSON output requires the 'json.vim' syntax highlighting scripts, located at: https://github.com/elzr/vim-json viewjson first added in https://github.com/spicyjack/publ…
_download_viewer () {
local OUTPUT_TYPE="$1"
local WGET_URL="$2"
JSON_XS_CMD=$(which json_xs)
VIM_CMD=$(which vim)
WGET_CMD=$(which wget)
if [ ! -x $JSON_XS_CMD -o ! -x $VIM_CMD -o ! $WGET_CMD ]; then
echo "ERROR: missing commands needed to run this function!"
echo "JSON_XS_CMD: ${JSON_XS_CMD}"
echo "VIM_CMD: ${VIM_CMD}"
@spicyjack
spicyjack / log4perl_setup.pl
Last active December 22, 2015 20:39
Some setup for Log::Log4perl
# color log output
if ( $cfg->get(q(colorize)) ) {
$log4perl_conf .= q(log4perl.appender.Screen )
. qq(= Log::Log4perl::Appender::ScreenColoredLevels\n);
} else {
$log4perl_conf .= q(log4perl.appender.Screen )
. qq(= Log::Log4perl::Appender::Screen\n);
}
# the rest of the log4perl setup
use Rex -feature => [qw/use_server_auth/];
use Rex::Commands::Gather;
use Rex::Group::Lookup::INI;
groups_file "../servers.ini";
#group servers => qw/foo bar/;
desc "Get info about the servers in 'servers.ini'";
### TASK: uptime
$ rex -Tv Rexfile
Tasks
Server Groups
servers foo, bar
$ rex -Tv -d Rexfile
[2014-08-23 06:12:28] DEBUG - Command Line Parameters
[2014-08-23 06:12:28] DEBUG - d = 1
[2014-08-23 06:12:28] DEBUG - v = 1
[2014-08-23 06:12:28] DEBUG - T = 1
[2014-08-23 06:12:28] DEBUG - Rexfile exists
use strict;
use warnings;
use Rex -feature => ["use_server_auth"];
use Rex::Commands::Gather;
use Rex::Group::Lookup::INI;
groups_file "../servers.ini";
desc "Get info about the servers in 'servers.ini'";
use strict;
use warnings;
use Rex -feature => qw/use_server_auth/;
use Rex::Commands::Gather;
use Rex::Group::Lookup::INI;
groups_file q(../servers.ini);
desc "Get info about the servers in 'servers.ini'";
use strict;
use warnings;
#use Rex -feature => [qw/use_server_auth/];
use Rex -feature => qw/use_server_auth/;
use Rex::Commands::Gather;
use Rex::Group::Lookup::INI;
groups_file "../servers.ini";
#group servers => qw/foo bar/;