Skip to content

Instantly share code, notes, and snippets.

@ckxng
ckxng / keybase.md
Created May 15, 2017 01:28
keybase.md

Keybase proof

I hereby claim:

  • I am ckxng on github.
  • I am cameronking (https://keybase.io/cameronking) on keybase.
  • I have a public key ASD_TFHaQW4s3t90kwRm4s8oEA1pqyvOXpL2i150zVgtAAo

To claim this, I am signing this object:

#!/usr/bin/perl -wT
package CameronKing::Readme;
use strict;
use 5.005;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(readme);
our $VERSION = '0.20191230';
@ckxng
ckxng / index.js
Created January 6, 2020 04:52
AWS Lambda Video Transcode
// trigger: adding a file to S3 bucket
// result: files are transcoded
var aws = require('aws-sdk');
var elastictranscoder = new aws.ElasticTranscoder();
// return basename without extension
function basename(path) {
return path.split('/').reverse()[0].split('.')[0];
}
@ckxng
ckxng / namegen
Created January 18, 2020 01:35
generate user profiles with names, logins, birthdays, and email addresses
#!/bin/bash
# Constants
X=0
FNAMES_F=~/share/dict/fnames # a file of newline separated first names
LNAMES_F=~/share/dict/lnames # a file of newline separated last names
# total number of non-random words available
FNAMES_SZ=`cat ${FNAMES_F} | wc -l`
LNAMES_SZ=`cat ${LNAMES_F} | wc -l`
@ckxng
ckxng / .bashrc
Created January 21, 2020 14:38
log user commands
function log2syslog
{
declare COMMAND
COMMAND=$(fc -ln -0)
TTY=$(tty)
TTYOWNER=$(stat -c ‘%U’ ${TTY})
logger -p local1.notice -t bash -i -- “${TTY}:${TTYOWNER}:${USER}:${COMMAND}"
}
trap log2syslog DEBUG
@ckxng
ckxng / 01_alpinelvmsetup.sh
Last active December 20, 2021 05:29
alpine 3.11 lvm setup
setup-keymap
setup-hostname
setup-interfaces
setup-dns
hostname=$(cat /etc/hostname)
hostname $hostname
domainname=$(grep search /etc/resolv.conf|cut -f2)
rc-service networking start
passwd
setup-timezone
@ckxng
ckxng / .block
Last active May 9, 2020 02:36
blockbuilder demo
license: mit
height: 150
#!/usr/bin/perl -w
my $h = {};
while(read DATA, $_, 1) {
$h->{$_} = 0 unless $h->{$_};
$h->{$_}++;
}
use Data::Dumper;
print Dumper($h);
@ckxng
ckxng / docker-compose.yml
Created August 5, 2020 23:45
Docker compose for smokeping on RaspberryPI
---
version: "2"
services:
smokeping:
image: linuxserver/smokeping
container_name: smokeping
environment:
- PUID=1000
- PGID=1000
- TZ=US/Central
@ckxng
ckxng / .gitconfig
Last active August 27, 2020 06:38
personal .gitconfig
[core]
# on windows:
# autocrlf = true
# on linux:
autocrlf = input
[alias]
lol = log --oneline --decorate --graph --all --color=auto
co = checkout
st = status
ci = commit