Skip to content

Instantly share code, notes, and snippets.

View tresf's full-sized avatar

Tres Finocchiaro tresf

View GitHub Profile
@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/ && \
#!/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
@tresf
tresf / README.MD
Last active December 15, 2022 19:49
PowerShell QZ Tray Session Stealer (for Windows fast user switching)

PowerShell QZ Tray Session Stealer

Custom session stealer for Windows fast user switching

For a pure Batch solution, see here instead: https://gist.github.com/tresf/ff91bd29f1f6846c13bf6f8bc255ab55

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
@tresf
tresf / active_sessions.ps1
Last active December 14, 2022 17:44
PowerShell: Get active windows login sessions
# Adopted from: https://www.reddit.com/r/PowerShell/comments/306mcn/wtsenumeratesessions/
# Original Author: u/geostude
$_WTSMyStruct_Def = @'
namespace mystruct {
using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential)]
public struct WTS_SESSION_INFO {
public Int32 SessionID;