Skip to content

Instantly share code, notes, and snippets.

View diamondburned's full-sized avatar

Diamond diamondburned

View GitHub Profile
@diamondburned
diamondburned / main.go
Created March 10, 2025 07:05
Gio + OpenGL Core Reproducing Program
// SPDX-License-Identifier: Unlicense OR MIT
// GLFW doesn't build on OpenBSD and FreeBSD.
//go:build !openbsd && !freebsd && !android && !ios && !js
// +build !openbsd,!freebsd,!android,!ios,!js
// The glfw example demonstrates integration of Gio into a foreign
// windowing and rendering library, in this case GLFW
// (https://www.glfw.org).
//
@diamondburned
diamondburned / watch-autolock.sh
Created November 3, 2024 21:58
Script to observe for smartwatch's BT signal strength and autolock when it's weak
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bluez
BT_DEVICE="XX:XX:XX:XX:XX:XX"
BT_RSSI_THRESHOLD=-15
get_rssi() {
out=$(hcitool rssi $BT_DEVICE) || return 1
out=${out#*: }
echo $out
@diamondburned
diamondburned / kubeconf
Created July 29, 2024 03:14
kubeconf is a program that assists in managing multiple kubeconfigs. It remembers where kubeconfigs are and allows switching between them.
#!/usr/bin/env bash
KUBECONF_CONFIG_DIR="${XDG_CONFIG_HOME:-"$HOME/.config"}/kubeconf"
KUBECONF_KNOWN_CONFIGS="$KUBECONF_CONFIG_DIR/known_configs"
kubeconf() {
case "$1" in
a|add)
_kubeconf::add "${@:2}"
;;
@diamondburned
diamondburned / gotk4-run.sh
Last active March 11, 2025 00:56
Run gotk4 programs using the system's Nixpkgs because Nix Flakes sucks!!!
#!/usr/bin/env bash
set -eo pipefail
NIX_EXPR=$(cat <<-'EOF'
{
mainProgram,
}:
let
pkgs = import <nixpkgs> { };
@diamondburned
diamondburned / script.js
Created May 4, 2024 06:18
Hypnohub Auto-load Bigger Thumbnails
// ==UserScript==
// @name Hypnohub Auto-load Bigger Thumbnails
// @version 1
// @grant none
// @match *://hypnohub.net/*
// @run-at document-end
// @noframes
// ==/UserScript==
async function urlExists(url) {
const ok = await fetch(url, {method: "GET"}).then(r => r.ok).catch(() => false)
// ==UserScript==
// @name WS hack
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over Discord!
// @author You
// @match https://discord.com/*
// @grant none
// @run-at document-start
// @require https://cdnjs.cloudflare.com/ajax/libs/pako/1.0.11/pako.min.js
@diamondburned
diamondburned / style.css
Last active March 27, 2024 07:41
freedesktop.org but readable
@-moz-document domain("freedesktop.org") {
.refentry {
max-width: 765px;
line-height: 1.5;
margin: auto;
position: relative;
}
.refentry pre {
line-height: 1.25;

This patch is carried over from Nixpkgs' pkgs/development/compilers/go/go_no_vendor_checks-1.21.patch.

It is required for Nixpkgs' buildGoModule to work with Go 1.14+.

@diamondburned
diamondburned / style.css
Created December 11, 2023 04:55
Advent of Code CSS but actually good
* {
box-sizing: border-box;
}
body {
margin: 0 auto;
padding: 1em 1.5em;
min-height: 100vh;
max-width: 800px;
min-width: auto;
116 854
81 793
42 777
33 830
36 826
49 874
85 892
74 852
96 846
99 819