Skip to content

Instantly share code, notes, and snippets.

View zopieux's full-sized avatar

Alexandre Macabies zopieux

View GitHub Profile
@zopieux
zopieux / panzoom.js
Created December 25, 2023 23:29
SVG *coordinate* (abstract, manual, maths) pan zoom, *not* using SVG transforms
const s = document.querySelector('svg');
const [c1, c2] = [...s.querySelectorAll('circle')];
const mat = new DOMMatrix();
let origScene = null, lastWorld = null;
s.addEventListener('mousedown', (evt) => {
lastWorld = { x: evt.offsetX || (evt.pageX - s.offsetLeft), y: evt.offsetY || (evt.pageY - s.offsetTop) };
origScene = new DOMPoint(lastWorld.x, lastWorld.y).matrixTransform(mat.inverse());
});
@zopieux
zopieux / dune3d.nix
Created October 28, 2023 16:55
dune3d nix package
{ stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, python3, gobject-introspection, gtkmm4, libepoxy, eigen, opencascade-occt, mimalloc, glm, libuuid, range-v3, librsvg }:
stdenv.mkDerivation {
pname = "dune3d";
version = "9af108e";
src = fetchFromGitHub {
owner = "dune3d";
repo = "dune3d";
rev = "9af108e591b3cdadf71f23e366f72dc8af8359bf";
@zopieux
zopieux / 0001-Audio-export-conversion-hack-for-training-aids.patch
Created September 21, 2023 20:55
MuseScore audio export hack for training aids
From bbd014bf407b2ec97fa18cca89d46d1867f62c83 Mon Sep 17 00:00:00 2001
From: Alexandre Macabies <[email protected]>
Date: Thu, 21 Sep 2023 22:53:31 +0200
Subject: [PATCH] Audio export conversion hack for training aids.
---
default.nix | 174 +++++++++++++
flake.lock | 61 +++++
flake.nix | 27 ++
src/app/app.cpp | 2 +
@zopieux
zopieux / mpv_streamlink_mosaic.py
Last active May 8, 2022 19:35
Xorg clipboard + streamlink + mpv in a mosaic / tile layout
@zopieux
zopieux / hexadecordle.js
Last active March 18, 2022 17:13
A sane horizontal layout for https://hexadecordle.co.uk/
const trs = [...document.querySelectorAll('#container>table>tbody>tr')]
const beg = trs.splice(0, 2)
trs.filter((x,i) => i%2==0).forEach(tr => {
tr.querySelectorAll(':scope > td').forEach(td => beg[0].insertAdjacentElement('beforeend', td))
})
document.querySelectorAll('#container>table>tbody>tr>td').forEach(e => e.style.width=100/16)
document.querySelector('body').style.fontFamily = 'monospace'
document.querySelector('#body').style.maxWidth = null
document.querySelector('#body').style.width = '100%'
document.querySelector('#game').style.width = '100%'
@zopieux
zopieux / RSL366R.c
Last active January 10, 2021 18:04
Remote RSL366R (433.95MHz) Arduino program
// https://github.com/sui77/rc-switch
#include <RCSwitch.h>
#define CONFIG_BUFSIZE ((8 + 16 + 8) / 8)
typedef union {
struct {
uint8_t transmitPin;
uint16_t pulseLength;
uint8_t repeatTx;
} c;
### Keybase proof
I hereby claim:
* I am zopieux on github.
* I am zopieux (https://keybase.io/zopieux) on keybase.
* I have a public key ASCq3dB3j_rLJ_JoF2t2F5Km_8nVHoa-v_nNsWh0aDEBUgo
To claim this, I am signing this object:
@zopieux
zopieux / README.md
Last active November 18, 2024 11:35
QNAP TS-453 Pro: LCD, LEDs, fan & buttons

QNAP TS-453 Pro: LCD, LEDs, fan & buttons

QNAP NAS model TS-453 Pro has limited documentation on how to control its various peripherals, namely:

  • the front LCD display, a 2 row, 16 column blue & white LCD display, and its two menu buttons ("ENTER", "SELECT")
  • the front LEDs "STATUS" (red & green) & "USB" (blue)
  • the 4 "disk error" LEDs (red)
  • the front "USB COPY" button
  • the main rear fan
@zopieux
zopieux / ocr-pdf.py
Last active April 7, 2018 17:41
Google OCR to PDF invisible overlay
#!/usr/bin/env python3
"""
Example usage:
$ pip install reportlab pillow
$ ./overlay.py these-lemaire.tiff 'ocr/{p}.json' these-lemaire.pdf
"""
import argparse
import json
@zopieux
zopieux / citename.py
Created March 28, 2018 13:22
Sphinx citation title
import docutils.nodes
import sphinx.roles
class CiteRole(sphinx.roles.XRefRole):
def result_nodes(self, document, env, node, is_ref):
keys = node['reftarget'].split(',')
refnodes = [
docutils.nodes.reference(classes=['citation'], refuri=key)
for key in keys]