Skip to content

Instantly share code, notes, and snippets.

View serverwentdown's full-sized avatar

Ambrose Chua serverwentdown

View GitHub Profile
@serverwentdown
serverwentdown / Vagrantfile.k3s-dev-cluster
Last active April 2, 2024 12:56
A dual-stack embedded-etcd development k3s cluster (originally from this discussion: https://github.com/k3s-io/k3s/discussions/9807)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@serverwentdown
serverwentdown / Earthfile
Last active December 20, 2022 09:04
An Earthfile (https://earthly.dev) describing the build of snort
VERSION 0.6
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --yes \
libdumbnet1 libluajit-5.1-2 libpcap0.8 \
zlib1g libhwloc15 liblzma5 libssl1.1 \
libunwind8 \
@serverwentdown
serverwentdown / sidekiq_
Last active January 5, 2023 06:08
Munin Sidekiq plugin. Requires `perl-redis`. Install as `sidekiq_APP_NAME`
#!/usr/bin/perl -w
=head1 NAME
sidekiq - Get Sidekiq queue statistics from a Redis node
=head1 APPLICABLE SYSTEMS
Any Redis host with a Sidekiq application
@serverwentdown
serverwentdown / fprint-clear.c
Last active November 7, 2022 05:59
Clear fingerprint reader (Goodix, etc) fingerprints on Linux via direct libfprint calls.
// gcc `pkg-config --cflags --libs libfprint-2` -o fprint-clear fprint-clear.c
// compile, stop fprintd, run as root, start fprintd
#include <stdio.h>
#include <fprint.h>
int main() {
FpContext *ctx = fp_context_new ();
printf("Got context\n");
GPtrArray *devices = fp_context_get_devices (ctx);
did:3:kjzl6cwe1jw147mv939cydvcbka1117en9ao03c3fmgjrwrlmngkhbexm945svk

Some useful one-liners

Download tared binaries

# dust
wget -O - https://github.com/bootandy/dust/releases/download/v0.5.4/dust-v0.5.4-x86_64-unknown-linux-musl.tar.gz | tar -xz --strip-components 1 '*dust'

Comparing URL Query Parameter Parsers

Differences in parsers can result in security issues under certain circumstances. For example, cache poisoning.

Help me add to this list! Comment below

Source Key-value pair delimiters Issue
WHATWG Spec &
@serverwentdown
serverwentdown / IVARcluster.md
Last active May 4, 2020 16:12
IVARcluster, prices in SGD at time of commit.

To make it more interesting, this setup should include a variety of motherboards, SSDs, HDDs, memory and PSUs. I might start with one system, and build another one every 6 months. I forsee this list changing over time, but the base specifications are as follows:

  • CPU: >6 core, >4GHz
  • Storage: >256GB NVMe
  • Memory: >16GB, dual channel

Pricing Source:

Rack:

@serverwentdown
serverwentdown / hops_generate.py
Last active March 4, 2022 02:55
Some really useless script that generates IPv6 hops using netns for your traceroute pleasure.
import sys
import itertools
from netaddr import *
PREFIX = IPNetwork('fd00:0:3:1337::/64')
NAME = 'virtual0'
COUNT = 30
UPSTREAM=0
@serverwentdown
serverwentdown / cleanup
Created September 19, 2019 01:46
A bash script to normalise course documents.
#!/bin/bash
for file in */*; do
if ! [[ -f $file ]]; then
continue
fi
updated="$(echo $file | sed -E 's~^(([^/]*/)*)(ICT(-CSC)?[0-9]{4})?([- _]*)([^/]+)$~\1\6~')"
updated="$(echo $updated | sed -E 's~Chpt ?~Lect~')"
updated="$(echo $updated | sed -E 's~L(ecture|ect|ec|0)[- _]*0*([0-9]+)[- _]+~Lec\2 - ~')"
updated="$(echo $updated | sed -E 's~Lab[- _]*0*([0-9]+)[- _]+~Lab\1 - ~')"