Skip to content

Instantly share code, notes, and snippets.

View swelljoe's full-sized avatar

Joe Cooper swelljoe

View GitHub Profile
# vgt $oldver $newver - version greater than test
function vgt() {
parts=(${1//./ })
major=${parts[0]}
minor=${parts[1]}
newparts=(${2//./ })
newmajor=${newparts[0]}
newminor=${newparts[1]}
if (( $major < $newmajor )); then
return 0
@swelljoe
swelljoe / gist:42063a7da68246f36ef297d99bbe3c96
Created February 8, 2018 22:57
Virtualmin Pro installable scripts as of Feb 2 2018
Name Versions Available?
------------------------------ ------------------------------ ----------
Coppermine 1.5.46 Yes
Pydio 6.4.2 Yes
SugarCRM 6.5.26 Yes
phpMyFAQ 2.8.27 Yes
Dolibarr 5.0.7 4.0.6 3.9.4 Yes
Instiki 0.20.1 Yes
Trac 1.1.6 0.12.7 Yes
Node.js 9.5.0 Yes
donaldtrump.net
donaldtrump.nom
i-print4u.com
losangelesbrochurecompany.com
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
gc = gspread.authorize(credentials)
#!/usr/bin/perl
use strict;
use warnings;
use 5.010;
my $extrakey = "doot";
my $extraval = "toot";
my %hash = (
name => 'Joe',

Stuff I'm worried about:

detach.cgi/detachall.cgi

  • There's some tricky file and pipe related stuff in here, that I'm not confident I haven't broken, and don't know how to test.
  • Particularly the $buf in while loop thing

export.cgi

  • %done is in the right scope, and doesn't need to be our?
@swelljoe
swelljoe / print_category.pl
Last active May 29, 2016 20:36
Lookup table version of print_category function in Authentic
sub print_category {
my ( $c, $label ) = @_;
$label = $c eq "others" ? $text{'left_others'} : $label;
my %icon_table = (
'webmin' => 'fa-cog',
'usermin' => 'fa-cog',
'settings' => 'fa-cog',
'global_settings' => 'fa-cog',
'cat_settings' => 'fa-cog',
#!/bin/bash
# Nagios Plugin check_uptime
# This plugin returns CRITICAL if uptime is less than CRITICAL_THRESHOLD minutes
#
# Check for missing parameters
if [[ -z "$1" ]]; then
echo "Missing parameters! Syntax: ./nagios-uptime.sh CRITICAL_THRESHOLD"
exit 3
fi
# Get the current uptime in seconds and divide by 60 to get minutes