Skip to content

Instantly share code, notes, and snippets.

@pdcmoreira
pdcmoreira / navidromeRemoveAllMissingFiles.js
Created May 6, 2025 14:36
Batch remove all missing files from all pages in Navidrome's "Missing files" list - copy-paste into the console and run
(async () => {
const wait = (time) => new Promise(resolve => setTimeout(resolve, time))
const countElements = () => document.querySelectorAll('.MuiTableRow-root').length
while(countElements()) {
const selectAllInput = document.querySelector('.MuiIconButton-label input')
selectAllInput.click()
@MawKKe
MawKKe / cryptsetup-with-luks2-and-integrity-demo.sh
Last active October 1, 2025 19:45
dm-crypt + dm-integrity + dm-raid = awesome!
#!/usr/bin/env bash
#
# Author: Markus (MawKKe) ekkwam@gmail.com
# Date: 2018-03-19
#
#
# What?
#
# Linux dm-crypt + dm-integrity + dm-raid (RAID1)
#
@eliasdaler
eliasdaler / safe_reference.cpp
Last active June 5, 2021 03:40
Safe reference implementation. C++ part. See https://eliasdaler.github.io/game-object-references for details
#include <sol.hpp>
#include <string>
#include <iostream>
using EntityId = int;
class Entity {
public:
explicit Entity(EntityId id) :
name("John"), id(id)
@eliasdaler
eliasdaler / safe_reference.lua
Last active June 5, 2021 03:40
Safe reference implementation. Lua part. See https://eliasdaler.github.io/game-object-references for details
Handles = {}
local memoizedFuncs = {}
-- metatable which does magic
local mt = {}
mt.__index = function(handle, key)
if not handle.isValid then
print(debug.traceback())
error("Error: handle is not valid!", 2)
end
@mcnees
mcnees / graph paper.tex
Last active February 16, 2024 08:34
Make your own quadrille, graph, hex, etc paper! Uses the pgf/TikZ package for LaTeX, which should be part of any modern TeX installation.
%%-----------------------------------------------------------------------
%% Make your own quadrille, graph, hex, etc paper!
%% Uses the pgf/TikZ package for LaTeX, which should be part of
%% any modern TeX installation.
%% Email: mcnees@gmail.com
%% Twitter: @mcnees
%%-----------------------------------------------------------------------
\documentclass[11pt]{article}
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <string.h>
#define streq(a, b) (!strcmp((a), (b)))
#ifndef __USE_GNU
#define __USE_GNU
@Reedbeta
Reedbeta / cool-game-programming-blogs.opml
Last active August 2, 2025 22:38
List of cool blogs on game programming, graphics, theoretical physics, and other random stuff
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Graphics, Games, Programming, and Physics Blogs</title>
</head>
<body>
<outline text="Tech News" title="Tech News">
<outline type="rss" text="Ars Technica" title="Ars Technica" xmlUrl="http://feeds.arstechnica.com/arstechnica/index/" htmlUrl="https://arstechnica.com"/>
<outline type="rss" text="Polygon - Full" title="Polygon - Full" xmlUrl="http://www.polygon.com/rss/index.xml" htmlUrl="https://www.polygon.com/"/>
<outline type="rss" text="Road to VR" title="Road to VR" xmlUrl="http://www.roadtovr.com/feed" htmlUrl="https://www.roadtovr.com"/>
@pfultz2
pfultz2 / state_monad.cpp
Created November 11, 2014 01:29
State monad implemented in C++14
#include <utility>
#include <iostream>
struct void_
{
template<typename Stream>
friend Stream &operator<<(Stream &s, void_)
{
return s << "()";
}
@wvengen
wvengen / extend.sh
Last active September 27, 2025 02:40
Extend non-HiDPI external display above HiDPI internal display
#!/bin/sh
# extend non-HiDPI external display on DP* above HiDPI internal display eDP*
# see also https://wiki.archlinux.org/index.php/HiDPI
# you may run into https://bugs.freedesktop.org/show_bug.cgi?id=39949
# https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/883319
EXT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
ext_w=`xrandr | sed 's/^'"${EXT}"' [^0-9]* \([0-9]\+\)x.*$/\1/p;d'`