Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/perl -wT
use strict;
use warnings;
%ENV = ();
$ENV{'PATH'} = '/bin:/usr/bin';
sub untaintfp {
my $keyfp = shift or die "untaintfp missing parameter: keyfp\n";
my $utkeyfp = '';
@ckxng
ckxng / code.py
Last active January 9, 2023 05:17
QtPy Keyboard
import board
import neopixel
import touchio
from time import sleep
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
# pin that the NeoPixel is connected to
PIXEL_PIN: Pin = board.NEOPIXEL
@ckxng
ckxng / markdown-cli.go
Last active May 31, 2022 21:21
golang markdown-cli
package main
import (
"io/ioutil"
"bytes"
"fmt"
"os"
"github.com/yuin/goldmark"
"github.com/yuin/goldmark/extension"
"github.com/yuin/goldmark/parser"
"github.com/yuin/goldmark/renderer/html"
@ckxng
ckxng / minecraft
Last active May 31, 2022 21:22
minecraft rc file (freebsd)
#!/bin/sh
# from https://minecraft.fandom.com/wiki/Tutorials/FreeBSD_startup_script
#
# PROVIDE: minecraft
# REQUIRE: LOGIN DAEMON NETWORKING mountcritlocal
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local to enable the minecraft server:
#
# minecraft_enable="YES"
import turtle
print("Hello World.")
t = turtle.Turtle()
t.color('white')
t.left(90)
t.forward(100)
t.left(270)
#!/usr/bin/perl
#$Id$
use strict;
use warnings;
my $VERSION=1.000;
=head1 NAME
check_port80.pl
@ckxng
ckxng / 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 {
@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";
@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 = ();