Skip to content

Instantly share code, notes, and snippets.

View jshbrntt's full-sized avatar
🏠
Working from home

Joshua Barnett jshbrntt

🏠
Working from home
View GitHub Profile
@jshbrntt
jshbrntt / .wezterm.lua
Last active May 21, 2025 02:14
WezTerm Config - Windows Terminal Shortcuts
local wezterm = require 'wezterm';
local wsl_domains = wezterm.default_wsl_domains()
for idx, dom in ipairs(wsl_domains) do
dom.default_cwd = "~"
end
return {
wsl_domains = wsl_domains,
@jshbrntt
jshbrntt / setup_zomboid_server.sh
Last active April 30, 2025 06:34
Setting Up Project Zomboid Dedicated Server with Oracle Cloud Infrastructure - Instructions.md
#!/bin/bash
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
ORANGE=$(tput setaf 3)
BOLD=$(tput bold)
CLEAR=$(tput sgr0)
function warn { echo -en "\n\n${BOLD}${ORANGE}[-] $* ${CLEAR}\n"; }
function success { echo -en "${BOLD}${GREEN}[+] $* ${CLEAR}\n"; }
@jshbrntt
jshbrntt / config.yml
Created November 12, 2023 21:04
Kubernetes: Example HTTPS Certificate Resources
---
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-staging
spec:
acme:
# Change this to your email to receive notifications about the HTTPS certificate
email: user@example.com
privateKeySecretRef:
@jshbrntt
jshbrntt / wfh_percentages.lp
Created November 9, 2022 15:50
The proportion of workers hybrid working has risen slightly during spring 2022
wfh_percentage home=34u,work=39u,hybrid=9u 1610064000
wfh_percentage home=35u,work=39u,hybrid=10u 1610668800
wfh_percentage home=34u,work=39u,hybrid=9u 1611273600
wfh_percentage home=36u,work=36u,hybrid=11u 1611878400
wfh_percentage home=36u,work=36u,hybrid=11u 1612483200
wfh_percentage home=37u,work=34u,hybrid=10u 1613088000
wfh_percentage home=35u,work=36u,hybrid=10u 1613692800
wfh_percentage home=32u,work=39u,hybrid=10u 1614297600
wfh_percentage home=36u,work=38u,hybrid=10u 1614902400
wfh_percentage home=30u,work=41u,hybrid=12u 1615507200
@jshbrntt
jshbrntt / lockdown_events.lp
Last active November 7, 2022 17:29
Timeline of UK government coronavirus lockdowns and restrictions
lockdown_event,type=PM\ /\ government\ announcements description="PM says \"now is the time for everyone to stop non-essential contact and travel\"." 1584316800
lockdown_event,type=PM\ /\ government\ announcements description="PM says the UK can \"turn tide of coronavirus\" in 12 weeks." 1584576000
lockdown_event,type=Lockdown\ restrictions\ introduced description="PM announces the first lockdown in the UK, ordering people to \"stay at home\"." 1584921600
lockdown_event,type=Legislation\ /\ emergency\ powers description="Coronavirus Act 2020 gets Royal Assent." 1585094400
lockdown_event,type=Lockdown\ restrictions\ introduced description="Lockdown measures legally come into force." 1585180800
lockdown_event,type=Lockdown\ restrictions\ introduced description="Lockdown extended for \"at least\" three weeks. Government sets out five tests that must be met before restrictions are eased." 1586991600
lockdown_event,type=PM\ /\ government\ announcements description="PM says \"we are past the peak\" of the pandemic.
@jshbrntt
jshbrntt / videos2web.sh
Last active December 28, 2021 21:41
Script to convert videos to web compatible formats.
#!/bin/bash
printf "\e[1;36m\n\
_ _ ____ _ \n\
__ _(_) __| | ___ ___ ___|___ \__ _____| |__ \n\
\ \ / / |/ _\` |/ _ \/ _ \/ __| __) \ \ /\ / / _ \ '_ \ \n\
\ V /| | (_| | __/ (_) \__ \/ __/ \ V V / __/ |_) | \n\
\_/ |_|\__,_|\___|\___/|___/_____| \_/\_/ \___|_.__/ \n\
https://gist.github.com/joshua-barnett/0764f654ba992b663ee9\n\
Usage: \n\
$ ./videos2web.sh input_directory/ output_directory \e[m\\n"
@jshbrntt
jshbrntt / grpc.js
Last active April 9, 2021 16:11
gRPC + JSON in Node.js
const process = require('process');
const grpc = require('@grpc/grpc-js');
/**
* $ node grpc.js server
*
* Server listening { port: 9001 }
* Received { request: { message: 'Hello Server!' } }
*
* $ node grpc.js client
@jshbrntt
jshbrntt / mongo-test.js
Created December 18, 2020 15:22
Create MongoDB container that starts and initializes itself as a single node replicaset
const Docker = require('dockerode');
(async () => {
const docker = new Docker();
const container = await docker.createContainer({
name: 'mongodb',
Image: 'mongo:4.0.20@sha256:dd4cbe24eb8233db92b871cc556b77efcc7f9e67bc9516579796d4d08818273e',
Cmd: [
"bash",
"-c",
@jshbrntt
jshbrntt / log.cpp
Created January 31, 2014 12:33
Color Logging in Win32
#include <Windows.h>
#include <cstdio>
#include "log.h"
#define COLOR_BLACK 0x0
#define COLOR_BLUE 0x1
#define COLOR_GREEN 0x2
#define COLOR_AQUA 0x3
#define COLOR_RED 0x4
{
"basics": {
"email": "joshua@barne.tt",
"label": "Professional Keyboard Slapper 👋 ⌨️ 💻",
"location": {
"city": "Cambridge",
"countryCode": "GB"
},
"name": "Joshua Barnett",
"profiles": [