Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl
#$Id$
use strict;
use warnings;
my $VERSION=1.000;
=head1 NAME
check_port80.pl
@cameroncking
cameroncking / chack_mysql.pl
Created March 5, 2022 23:52
Check MySQL Replication Status
#!/usr/bin/perl
# $Id$
use strict;
use warnings;
my $VERSION = 0.006;
my $DEBUG = 1;
sub handle_wrn;
sub handle_err;
#!/usr/bin/perl
# Copyright 2012 Cameron King. ISC License
use strict;
use warnings;
# changelog
# 1.00 - initial version
# 1.01 - change apc.include_once_override to 0
sub block2 {
@cameroncking
cameroncking / mysqldiag.pl
Created March 5, 2022 23:34
MySQL Diagnostics
#!/usr/bin/perl
use strict;
use warnings;
system "mkdir /var/log/sec/" unless -d "/var/log/sec";
my $date=`date -Is`;
chomp $date;
my $fn="/var/log/sec/mysql-diag_${date}_$$.log";
open LOG, ">$fn";
@cameroncking
cameroncking / puppet-facts.pl
Created March 5, 2022 23:32
Puppet Facts for Client
#!/usr/bin/perl
# Client Xenon Product Facts
# Cameron King <http://cameronking.me>
# Version 1.01 - add magento and wordpress counts
# Version 1.00 - initial version
use warnings;
use strict;
my $VERSION = 1.01;
my %facts = ();
#!/bin/sh
# password for vscode
PASS=XXX
# hostname at duckdns.org
HOST=XXX
# duckdns.org token
DUCK=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
# sysadmin email
EMAIL=XXX@XXX.XXX
import turtle
t = turtle.Turtle()
for c in ['red', 'green', 'yellow', 'blue']:
t.color(c)
t.forward(75)
t.left(90)
@cameroncking
cameroncking / dsa-http-svc-chk
Created April 21, 2021 16:10
quick ldap dsa healthcheck service
#!/usr/bin/env python3
"""simple socket service simulating an HTTP response to see if LDAP DSA is alive
"""
from subprocess import Popen, PIPE
from json import dumps
import socket
import sys
bind_host = ""
bind_port = 1200
@cameroncking
cameroncking / emergency-shell
Last active January 3, 2021 14:52
emergency shell script
#!/usr/bin/perl -WT
# Using taint and strict. All variables must be declared and all input must be
# processed before use. The most aggressive settings are used for warnings.
# This script will fail if it is misused or perscribed conditions are not met.
use warnings FATAL => 'all';
use strict;
=head1 NAME
emergency-shell
#!/bin/sh
# parse the page and pagepath from QUERY_STRING
page=$(
echo "${QUERY_STRING}" | \
sed -n 's/^.*page=\([^&]*\).*$/\1/p' | \
sed 's/[^a-zA-Z0-9\/\-_]/X/g'
)
if [ "${page}" = '' ]; then
page='index'