Skip to content

Instantly share code, notes, and snippets.

@ckxng
ckxng / modelhelper.js
Created August 28, 2020 00:33
sample of uos model helper function
/**
* model helper module
*
* This module contains helper functions for interacting with models
*
* @module lib/modelhelper
*/
// jshint.unstable bigint: true
var Members = require("../models/members");
@ckxng
ckxng / .emacs
Created October 13, 2020 08:31
orgmode config
(define-key global-map "\C-ca" 'org-agenda)
(set-time-zone-rule "US/Central")
(require 'org)
(setq org-clock-persist 'history)
(setq org-agenda-files (list "~/org/athenahealth.org"
#!/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'
@ckxng
ckxng / 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
@ckxng
ckxng / 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
import turtle
t = turtle.Turtle()
for c in ['red', 'green', 'yellow', 'blue']:
t.color(c)
t.forward(75)
t.left(90)
#!/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
@ckxng
ckxng / 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 = ();
@ckxng
ckxng / 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";
#!/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 {