Skip to content

Instantly share code, notes, and snippets.

View jhunt's full-sized avatar
🎧
codin'

James Hunt jhunt

🎧
codin'
View GitHub Profile
@jhunt
jhunt / combined.sql
Created July 31, 2020 15:24
mariadb northwind
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
DROP SCHEMA IF EXISTS `northwind` ;
CREATE SCHEMA IF NOT EXISTS `northwind` DEFAULT CHARACTER SET latin1 ;
USE `northwind` ;
-- -----------------------------------------------------
-- Table `northwind`.`customers`
#!/bin/bash
set -u
back="\e[0m"
red="\e[1;31m"
green="\e[1;32m"
yellow="\e[1;33m"
blue="\e[1;34m"
purple="\e[1;35m"
cyan="\e[1;36m"
@jhunt
jhunt / Watching-Upstream-Releases.md
Last active March 17, 2022 00:05
Watching Upstream HTTP Download Sites for New Versions

Watching Upstream Releases

For a while now I've had an idea for a VERY lightweight CI/CD solution based on Kubernetes CronJobs, and a bespoke set of heuristic "version checkers" that can parse a single source -- HTTP downloads listing, a GitHub repository's release feed, etc. -- and determine if you need to go download a new thing.

This is a quick hacky sketch of what those checkers might look like, because it's late, I can't sleep, and I'm otherwise unoccupied.

@jhunt
jhunt / signals.pl
Created September 30, 2015 00:38
Decoding Sig* fields from /proc/<PID>/status
#!/usr/bin/perl
@sigs = qw(
SIGHUP SIGINT SIGQUIT SIGILL SIGTRAP
SIGABRT SIGBUS SIGFPE SIGKILL SIGUSR1
SIGSEGV SIGUSR2 SIGPIPE SIGALRM SIGTERM
SIGSTKFLT SIGCHLD SIGCONT SIGSTOP SIGTSTP
SIGTTIN SIGTTOU SIGURG SIGXCPU SIGXFSZ
SIGVTALRM SIGPROF SIGWINCH SIGIO SIGPWR
SIGSYS
@jhunt
jhunt / flags.cl
Created December 14, 2021 21:02
Using Lisp Macros to Fact-Check Code at Compile Time
;;
;; This code was extracted from a larger project
;; and used in a Twitter thread on using macros
;; to fact-check programmers at compile-time.
;;
;; https://twitter.com/iamjameshunt/status/1470845641027129345
;;
(defun -flags-for (num)
(format nil "~{~A~}"
@jhunt
jhunt / json-encode.cl
Created September 8, 2021 13:49
JSON encoding in Lisp!
(defun alist? (lst)
(cond ((null lst) t)
((listp lst) (and (consp (car lst))
(alist? (cdr lst))))
(t nil)))
(defun json-encode-obj (v)
(format nil "~{~a~^,~}"
(mapcar (lambda (pair)
(format nil "\"~(~a~)\":~a"
@jhunt
jhunt / kubernetes.yml
Last active August 3, 2020 20:14
A Gluon Deployment for Kubernetes
---
apiVersion: v1
kind: ConfigMap
metadata:
name: buffalo-lab-boshes
data:
vcenter_ip: your.vsphere.example.com
vcenter_dc: dc1
vcenter_cluster: cluster1
@jhunt
jhunt / cert-issuer.yml
Last active June 16, 2020 18:06
Gluon Kubernetes Controller Deployment YAML
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
name: internal-ca
namespace: cert-manager
spec:
selfSigned: {}
@jhunt
jhunt / just-a-pod.yml
Created February 12, 2020 14:52
Running Pods (natively) ain't such a great idea, after all.
apiVersion: v1
kind: Pod
metadata:
name: its-a-pod
spec:
containers:
- image: filefrog/k8s-hacks:falldown
name: its-a-pod
@jhunt
jhunt / gist:3d3200fca04b6d6614766a920fbc8453
Created August 15, 2019 13:52
Patch for provider ID args based on BOSH vm name / ID
diff --git a/jobs/kubelet/templates/bin/kubelet b/jobs/kubelet/templates/bin/kubelet
index c5b0e52..a52cb13 100644
--- a/jobs/kubelet/templates/bin/kubelet
+++ b/jobs/kubelet/templates/bin/kubelet
@@ -34,6 +34,7 @@ end
# set kube-* binaries in our path
export PATH=$PATH:/var/vcap/packages/k8s/bin
+export PATH=$PATH:/var/vcap/packages/jq/bin