Skip to content

Instantly share code, notes, and snippets.

View wperron's full-sized avatar
🚀
Launching into orbit

William Perron wperron

🚀
Launching into orbit
View GitHub Profile
@wperron
wperron / prom-compare.js
Created May 11, 2023 13:24
Compare two different sets of prometheus metrics based on the output of the `/metrics` endpoint
#!/usr/bin/env deno run -A
import { readStringDelim } from "https://deno.land/std@0.186.0/io/read_string_delim.ts";
import * as path from "https://deno.land/std@0.186.0/path/mod.ts";
async function extractMetricNames(f) {
const filename = path.join(Deno.cwd(), f);
let fileReader = await Deno.open(filename);
let metrics = new Set();
// homerunner is Brad's shitty Docker wrapper after he got tired of running
// HA nine-VM Kubernetes clusters. Earlier versions of this tried to use podman
// and fancy cloud-init and CNI stuff but then I decided to go to the other
// extreme and write something super specific to what I need and super dumb:
// run my containers from gcr.io, and use my home Ceph cluster for mounts/state.
//
// This primarily runs Home Assistant, HomeSeer, an MQTT server, and some cameras.
// And some omitted misc stuff.
package main
@eh8
eh8 / README.md
Last active December 13, 2020 06:36
macOS Big Chungus

From r/unixporn

macOS Big Chungus


Find the official macOS wallpapers complied in a neat Google Photos album.

This setup relies on a few GNOME shell extensions, all of which are available from the AUR.

@wwek
wwek / httpsproxy.go
Created October 29, 2017 05:41
https proxy in golang
// https://medium.com/@mlowicki/http-s-proxy-in-golang-in-less-than-100-lines-of-code-6a51c2f2c38c
// #!/usr/bin/env bash
// case `uname -s` in
// Linux*) sslConfig=/etc/ssl/openssl.cnf;;
// Darwin*) sslConfig=/System/Library/OpenSSL/openssl.cnf;;
// esac
// openssl req \
// -newkey rsa:2048 \
// -x509 \
@thedevsaddam
thedevsaddam / ReadFile.go
Created January 16, 2017 05:20 — forked from pagoenka/ReadFile.go
Reading file, line by line in Go lang using scanner
package main
import (
"bufio"
"fmt"
"os"
)
func main() {
@yi
yi / gist:01e3ab762838d567e65d
Created July 24, 2014 18:52
lua hex <= => string
function string.fromhex(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function string.tohex(str)
return (str:gsub('.', function (c)
return string.format('%02X', string.byte(c))
end))