Skip to content

Instantly share code, notes, and snippets.

View tresf's full-sized avatar

Tres Finocchiaro tresf

View GitHub Profile
@tresf
tresf / tst-dlp.txt
Last active November 7, 2024 20:28
CAS DLP 50 Test File
; Define label form
FS"SampleLabel" ; Start a new form with the name "SampleLabel"
; Set label length and spacing
Q200,20 ; Set label length to 200 dots (25mm) and spacing to 20 dots
; Set print density and speed
D6 ; Set print density to medium (6 out of 15)
S1 ; Set print speed to 37.5 mm/sec
mirror=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/cr-48-ubuntu
# fw_type will always be developer for Mario.
# Alex and ZGB need the developer BIOS installed though.
fw_type="`crossystem mainfw_type`"
if [ ! "$fw_type" = "developer" ]
then
echo -e "\nYou're Chromebook is not running a developer BIOS!"
echo -e "You need to run:"
echo -e ""
echo -e "sudo chromeos-firmwareupdate --mode=todev"
@tresf
tresf / primaryMAC.js
Last active September 27, 2024 15:39
Find primary MAC Address for a given machine
function findPrimaryMac(adapters, burnedInOnly) {
// Only interested in adapters with MAC addresses
adapters = adapters.filter((adapter) => adapter.mac);
if(burnedInOnly) {
adapters = sift.keep(adapters, {burnedIn: true });
}
// find best match (see https://github.com/qzind/sift/issues/12)
if(adapters.length > 1) {
// First, blindly trust what Java says the primary adapter is
for(var i in adapters) {
@tresf
tresf / DarwinHidApiLibrary.java
Last active June 6, 2024 18:52
Thread safe wrapping of hid4java calls
package org.hid4java.jna;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.WString;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
# Downloads an executable from the provided URL for use in a build system
# and optionally prepends it to the PATH
#
# Assumes:
# - CMAKE_CURRENT_BINARY_DIR/[${_name}]
# - CPACK_CURRENT_BINARY_DIR/[${_name}]
# - Fallback to $ENV{TMPDIR}/[RANDOM]/[${_name}]
# - For verbose, set COMMAND_ECHO to STDOUT in calling script
#
macro(download_binary RESULT_VARIABLE _url _name _prepend_to_path)
@tresf
tresf / wrongbrew.sh
Last active November 14, 2024 00:45
Homebrew, but for the wrong architecture
#!/usr/bin/env 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