Skip to content

Instantly share code, notes, and snippets.

@Wolf480pl
Wolf480pl / dm-status.sh
Created November 13, 2023 23:45
a crude script for exporting device-mapper stats from dmsetup status to prometheus
#!/bin/bash
prefix="device_mapper_status"
d_echo() {
#echo "$@" >&2
true
}
CACHE_FIELDS_FIXED="
# This is the bullshit we have to do, because:
# 1. alertmanager upstream insists on embedding their assets inside the binary
# this is against Debian Policy, so Debian has to patch it out downstream, but
# 2. there's no elm-compiler package in Debian
# so Debian can't build script.js from source
#
# instead Debian provides a horrible generate-ui.sh script that downloads binary elm compiler
# from github and runs it as root without any hash verification or anything
#
# This means that neither Debian nor upsteram provide a prebuilt JS in a sane format.
2023-03-26T16:30:43.6545751Z The agent pool assigned to this job has hit their MacOs concurrency limits
2023-03-26T16:30:43.6859395Z Requested labels: macos-latest
2023-03-26T16:30:43.6859596Z Job defined at: Wolf480pl/git-annex-remote-rclone/.github/workflows/test.yml@refs/heads/tests
2023-03-26T16:30:43.6859667Z Waiting for a runner to pick up this job...
2023-03-26T16:33:30.2896263Z Job is waiting for a hosted runner to come online.
2023-03-26T16:33:36.7009395Z Job is about to start running on the hosted runner: GitHub Actions 5 (hosted)
2023-03-26T16:33:39.9981680Z Current runner version: '2.303.0'
2023-03-26T16:33:40.0022530Z ##[group]Operating System
2023-03-26T16:33:40.0023410Z macOS
2023-03-26T16:33:40.0023780Z 12.6.3
@Wolf480pl
Wolf480pl / 99-print.lua
Created December 3, 2022 21:46
dump dynamic wireplumber 0.4 config - place in main.lua.d or similar
function to_json(v)
function to_lines(x)
if type(x) ~= "table" then
return {"\"" .. tostring(x) .. "\""}
end
local ret = {"{"}
local comma = ""
for k, v in pairs(x) do
local s = to_lines(v)
table.insert(ret, comma .. "\"" .. tostring(k) .. "\": " .. s[1])
switch:
~150 kpps @ 64 byte/pkt UDP !!hit test machine limit
~300 kpps @ 64 byte/pkt UDP reverse !!hit test machine limit
~130 kpps @ 64 byte/pkt UDP bidir
~880 Mbit/s bidir @ mtu UDP bidir
~920 Mbit/s bidir @ TCP bidir
bridge wifi<->eth:
~55 kpps @ 64 byte/pkt UDP
~23 kpps @ 64 byte/pkt UDP bidir
(
var bsize = s.options.blockSize * 8;
var bufs = [nil, nil, nil, nil, nil, nil, nil, nil];
File.use("/bin/xkill", "rb", {|f|
"len: ".postln; f.length.postln;
8.do {|i|
bufs[i] = Buffer.alloc(s, f.length);
};
f.length.do {|j|
var b = f.getInt8;
const std = @import("std");
pub fn BoolOrNat(comptime b : bool) type {
if (b) {
return bool;
} else {
return usize;
}
}
_. input ::= ;
_. input ::= input line;
_. stmt_separator ::= NEWLINE;
_. stmt_separator ::= SEMICOLON;
_. opt_newline ::= NEWLINE;
_. opt_newline ::= ;
_. common_block ::= INCLUDE QUOTED_STRING stmt_separator;
_. common_block ::= DEFINE identifier "=" initializer_expr stmt_separator;
_. common_block ::= REDEFINE identifier "=" initializer_expr stmt_separator;
_. common_block ::= UNDEFINE identifier stmt_separator;
@Wolf480pl
Wolf480pl / cairo-cat.py
Created September 22, 2019 16:14
An example python script drawing a basic cat using cairo
#!/usr/bin/python2
import pygtk
pygtk.require('2.0')
import gtk, gobject, cairo
import math
def deg2rad(x):
return x * math.pi / 180
#!/usr/bin/python2
import sys
irccolors = (19, 20, 22, 24, 25, 26, 27, 28, 29)
ansicolors_gnome = ("32", "31", "35", "93", "92", "36", "96", "94", "95")
ansicolors_linux = ("0;32", "0;31", "0;35", "1;33", "1;32", "0;36", "1;36", "1;34", "0;35" )
colors = irccolors
ircformat = "{0}"