Skip to content

Instantly share code, notes, and snippets.

View mattdees's full-sized avatar

matt dees mattdees

View GitHub Profile
#!/usr/bin/perl
my $input = $ARGV[0];
if ( !-e $input ) {
die "File not found";
}
if ( -d $input) {
die "Path is a directory";
}
@mattdees
mattdees / WHMCS.pm
Created September 18, 2012 02:23
perl module to access the WHMCS API
package API::WHMCS;
use strict;
use HTTP::Tiny;
use JSON::XS;
use Digest::MD5 ('md5_hex');
our $VERSION = 0.001;
sub api_request {
my ($auth, $command, $args ) = @_;
my $authstr;
my $port;
$args ||= {};
my $server = $auth->{'server'};
my $access_hash = $auth->{'hash'};
my $user = $auth->{'user'};
<?php
error_reporting(E_ERROR | E_PARSE );
require_once('test-more-php/Test-More.php');
require_once('tests.php');
plan(3);
pass('http');
@mattdees
mattdees / gist:5123411
Created March 9, 2013 08:03
Query a random command from commandlinefu.com
#!/usr/bin/perl
use HTTP::Tiny;
use JSON;
my $command ='random';
#my $command = 'browse/last-week/sort-by-votes';
my $url = "http://www.commandlinefu.com/commands/${command}/json/";
#print Dumper $res;
@mattdees
mattdees / gist:5406024
Created April 17, 2013 17:05
Quick check script for IO::Socket::SSL support
#!/usr/bin/env perl
use strict;
use warnings;
use lib 'lib';
use IO::Socket::SSL;
use HTTP::Tiny;
use Data::Dumper;
@mattdees
mattdees / gist:5406040
Created April 17, 2013 17:08
HTTP::Tiny test results on CentOS 5.9
-------
HTTP::Tiny: master
OS Version: CentOS release 5.9 (Final)
OpenSSL: OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
IO::Socket::SSL: 1.86
'reason' key from get https://google.com: Internal Exception
-------
@mattdees
mattdees / gist:5500102
Created May 2, 2013 04:11
Gitlab init script for 5.1.0
#!/bin/bash
#
# GitLab
# Maintainer: @elvanja, @troyanov, @eiyaya, @foyo23
# App Version: 5.1.0
# chkconfig: 2345 82 55
# processname: puma
# processname: sidekiq
# description: Runs puma and sidekiq for nginx integration.
#!/usr/bin/env perl
use strict;
use warnings;
use Smokeping;
#
# CONFIG VARS, CHANGE THESE TO YOUR SETUP.
#
my $config_file = '/etc/smokeping/config';
sub _load_targets {
my @targets;
Smokeping::load_cfg($config_file, 1);
# get each server's info.
foreach my $group ( keys %{ $Smokeping::cfg->{'Targets'} } ) {
unless ( ref $Smokeping::cfg->{'Targets'}->{$group} ) {
# Unless the entry in the smokeping hash is a reference to another datastructure
next;
}