Skip to content

Instantly share code, notes, and snippets.

View tresf's full-sized avatar

Tres Finocchiaro tresf

View GitHub Profile
@tresf
tresf / wrongbrew.sh
Last active May 24, 2024 05:59
Homebrew, but for the wrong architecture
#!/bin/bash
#
# Install wrong architecture packages on macOS
# - Can only install one package at a time, unless using "brew bundle"
# - Uses `brew deps --tree` to loop over dependencies
# - For speed, tries to NOT upgrade a package automatically
# - To upgrade a package, use wrongbrew.sh uninstall <packagename> && wrongbrew.sh install <packagename>
# - Based on the example from @maxirmx https://stackoverflow.com/a/70822921/3196753
# Halt on first error
@tresf
tresf / LMMS aarch64.md
Last active May 21, 2024 04:43
Cross-compile LMMS for ARM64

Description

This tutorial was written for Ubuntu 20.04 and is based off of lmms/wiki/Compiling. It adapt well to other Ubuntu verisons or Linux distros, but the package names and sources.list entries will change.

Warning

Warning, this configuration uses ARM64 "port" versions of Ubuntu libraries which cause havoc on apt and the dependency chain. Don't do this on your main machine, or even one you slighlty care about.

Configure modern cmake

@tresf
tresf / unofficial-qz-7zip-installer.bat
Last active April 4, 2024 16:15
Unofficial QZ Tray + 7zip Installer
@ECHO OFF
SET INSTALLER=qz-tray-2.2.3-x86_64.exe
SET TEMPQZ=%USERPROFILE%\tempqz
SET SEVENZIP=%PROGRAMFILES%\7-Zip\7z.exe
REM Preflight: Check for admin
NET SESSION >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
REM Admin confirmed
) ELSE (
@tresf
tresf / ntk.md
Last active December 26, 2023 21:18
LMMS + Zyn + Non Toolkit

How to build NTK:

(adapted from Albrecht Schlosser)

  1. Install dependencies:
    sudo apt-get install \
       fontconfig \
       libxft-dev \
       libcairo2-dev \

libjpeg-dev \

@tresf
tresf / temurin_21_qemu_riscv.log
Created November 3, 2023 19:34
Temurin 21 RISC-V QEmu
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xffffffff9053df5e, pid=3312, tid=3313
#
# JRE version: (21.0.1+12) (build )
# Java VM: OpenJDK 64-Bit Server VM (21.0.1-beta+12-ea, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-riscv64)
# Problematic frame:
# j java.lang.System.registerNatives()V+0 java.base
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
@tresf
tresf / qemu_macos.md
Last active November 4, 2023 15:02
QEmu with Java MacOS Apple Silicon M1/M2/M3
wget https://download2.gluonhq.com/openjfx/19/openjfx-19_monocle-linux-x64_bin-sdk.zip -O \
out/javafx-linux-x86_64-19_monocle.zip && unzip out/javafx-linux-x86_64-19_monocle.zip && \
cp -R javafx-sdk-19 lib/javafx-linux-x86_64-19_monocle && mv javafx-sdk-19 out/javafx-linux-x86_64-19_monocle
pushd ~/Applications/qemu/debian-riscv64/ &amp;&amp; \
#!/bin/bash
keywords=('developer-low' 'door-open' 'fuser-over-temp' 'fuser-under-temp' 'input-tray-missing' 'interlock-open' 'interpreter-resource-unavailable' 'marker-supply-empty' 'marker-supply-low' 'marker-waste-almost-full' 'marker-waste-full' 'media-empty' 'media-jam' 'media-low' 'media-needed' 'moving-to-paused' 'opc-life-over' 'opc-near-eol' 'output-area-almost-full' 'output-area-full' 'output-tray-missing' 'paused' 'shutdown' 'spool-area-full' 'stopped-partly' 'stopping' 'timed-out' 'toner-empty' 'toner-low')
echo "INFO: This is an informational message, I guess?" >&2
for i in {1..290}
do
echo "STATE: ${keywords[$i % 29]}" >&2
sleep .1
done
@tresf
tresf / sign-message.deno.js
Created March 23, 2023 14:46
Signing using Deno + QZ Tray
/**
* Author: A. Tres Finocchiaro
* License: Public Domain
*/
import "https://raw.githubusercontent.com/qzind/tray/v2.2.2/js/qz-tray.js";
import { encode, decode } from "https://deno.land/std/encoding/base64.ts";
// Load certificate
qz.security.setCertificatePromise(function(resolve, reject) {
@tresf
tresf / print.js
Created February 2, 2023 23:38
QZ Tray + ThermalPrinterEncoder (Node.js)
let tpe = require('thermal-printer-encoder');
let ws = require('ws');
let qz = require('qz-tray');
let encoder = new tpe({
language: 'esc-pos'
});
let result = encoder
.initialize()
@tresf
tresf / README.MD
Last active December 15, 2022 19:49

Batch QZ Tray Session Stealer

Custom session stealer for Windows fast user switching

For a pure PowerShell solution, see here instead: https://gist.github.com/tresf/4e19e15ad38354af6732ee701c990102

Problem

  • QZ Tray is a singleton application, so only one instance can run at a time.
  • Windows fast-user switching feature leaves applications running when a new user signs onto a shared workstation
  • QZ Tray can "steal" the instance, however this is retroactive and places a burden on the user