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 / server.js
Created April 3, 2015 12:17
A tiny xip.io clone quickly written in node.js. Requires module dnsd. Sample site at .addr.eurica.eu.org. Report vulnaribilities if any! :-)
var dnsd = require('dnsd');
var server = dnsd.createServer(handler);
server.zone('addr.eurica.eu.org', 'eurica.eu.org', 'webmaster@eurica.eu.org', 'now', '2h', '30m', '2w', '10m');
server.listen(5354);
console.log("Server running at " + server.ip + ":" + server.port);
function handler(req, res) {
var question = res.question[0];
var hostname = question.name;
@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 / 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 / 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
@serverwentdown
serverwentdown / index.php
Last active April 6, 2022 23:46
Code for thumb.uni.me
<?php
// set_time_limit(3600);
$url = $_GET["url"];
if ($url) {
$width = $_GET["w"];
$allowed = array('jpg','gif','png');
$pos = strrpos($url, ".");
$str = substr($url,($pos + 1));
$ch = curl_init();
@serverwentdown
serverwentdown / Summer.css
Last active April 6, 2022 23:46
(MIT Licensed) Lato is "Summer" in Polish. Live: http://codepen.io/ambc/pen/waBqE A simple theme in CSS. Created initially for [Mou](http://mouapp.com/). Feel free to fork. Requires [Lato](http://google.com/fonts/specimen/Lato) and Monaco fonts installed. Should go well on print.
@import url(//fonts.googleapis.com/css?family=Lato:400,700,900,400italic,700italic,900italic);
/* Reset.css */ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
/* Stuff under public domain: */
*, *:before, *:after {
box-sizing: border-box;
}
*:focus {
@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

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'