Skip to content

Instantly share code, notes, and snippets.

View tresf's full-sized avatar

Tres Finocchiaro tresf

View GitHub Profile
~LOGO;LOGO-QZ-0;128;256;DOTS
1;1-256
2;1;66;68;70;72;74;82;84;256
3;1;64;67;69;71;83;85;256
4;1;61;63;65;67;84;86;256
5;1;58;60;62;64;86;88;256
6;1;53;55;57;59;61;87;89;256
7;1;51;54;56;58;87;89;91;256
8;1;47;49;51;53;55;89;91;256
9;1;44;46;48;50;52;90;92;256
@tresf
tresf / hello-pdfbox.py
Last active September 27, 2022 04:14
Python PDFBOX Example
# Hello PDFBOX - A suprisingly simple example for calling PDFBOX from Python
#
# Author: Tres Finocchiaro
# License: WTFPL
# STEPS:
# macOS:
# brew install python openjdk@11
# pip3 install jpype1
#
@tresf
tresf / qz-tray-angular.md
Last active January 6, 2022 19:52
QZ Tray Angular 11, 12, 13...

See also https://qz.io/wiki/api-overrides which has been updated to include these examples.

  1. QZ Tray uses the browser's path, but this is incompatible with Angular's browserless compiler. Allow the user of the browser's path by toggling this compiler feature off.

    package.json:

    -  }
    +  },
    +  "browser": {
    +    "path": false
@tresf
tresf / hexxit2_modpack.log
Created December 22, 2021 00:42
Hexxit 2 Crash MacOS (con't)
---- Minecraft Crash Report ----
// Daisy, daisy...
Time: 2021-12-21 19:23:32 EST
Description: Initializing game
java.lang.RuntimeException: Failed to compile shader: 0
at team.cqr.cqrepoured.client.render.shader.ShaderProgram.<init>(ShaderProgram.java:50)
at team.cqr.cqrepoured.client.render.shader.ShaderProgram.<init>(ShaderProgram.java:30)
at team.cqr.cqrepoured.client.render.shader.ShaderProgram$Builder.build(ShaderProgram.java:93)
@tresf
tresf / hexxit2.log
Last active December 22, 2021 00:43
Hexxit 2 Crash MacOS 10.14.6 Mojave
# Java: 8u311 x86_64
# Memory: 3GB RAM
# Launcher: Technic Launcher 4.708
# Launch Options: -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
# Error: Minecraft failed to start!
# Potential causes: Chocolate Quest Repoured Mod
# crash-2021-12-21_19.23.32-client.txt: https://gist.github.com/tresf/624d27e0634049685c1492a219c67a77
[B#708] Starting download of https://cdn.technicpack.net/platform2/pack-icons/896745.png?1639289357, with 3 tries remaining
[B#708] Running /Users/admin/Library/Application Support/technic/runtimes/jre-legacy/jre.bundle/Contents/Home/bin/java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -Xms3072m -Xmx3072m -Djava.library.path=/Users/admin/Library/Application Support/technic/modpacks/hexxit-ii/bin/natives -Dfml.core.libraries.mirror=http://mirror.technicpack.net/Technic/lib/fml/%s -Dfml.ignoreInval
import qz from 'qz-tray'
const jwa = require('jwa')
class QzPrint {
static config = null
// TODO: setupSig can safely be combined with setupCert if needed
static async setupSig () {
// TODO: move private key to flat file, read using AJAX/fetch/etc
// privateKey = fs.readFileSync(__dirname + '/private-key.pem');
var privateKey = '-----BEGIN PRIVATE KEY-----\n''
@tresf
tresf / qz-sha256.js
Last active September 21, 2021 14:14
A version of sha256 that won't break with non-UTF8 web pages
/*!
* @overview SHA-256 implementation in JavaScript
* @copyright Copyright (c) Chris Veness 2002-2014
* @license Licensed under MIT license
* See http://www.movable-type.co.uk/scripts/sha256.html
*
* WARNING: This library been modified from its original to work without UTF8 support
* If using with QZ Tray, please consider upgrading to qz-tray.js 2.1 instead. :)
*/
@tresf
tresf / ExtWinGDI.java
Last active August 16, 2021 19:06
ExtWinGDI.java
/**
* XDAMAGE Java Bindings - This is a simple extension of JNA Platform, adding the XFixes and XDamage extensions (and a couple more X11 functions)
* Copyright © 2012 SSHTOOLS Limited (support@sshtools.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@tresf
tresf / ExtUser32.java
Last active August 16, 2021 19:06
ExtUser32.java
/**
* XDAMAGE Java Bindings - This is a simple extension of JNA Platform, adding the XFixes and XDamage extensions (and a couple more X11 functions)
* Copyright © 2012 SSHTOOLS Limited (support@sshtools.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@tresf
tresf / LoaderShim.java
Last active August 13, 2021 03:06
Usb4Java Static Library Path Shim
package qz;
import com.sun.jna.Platform;
import org.usb4java.LibUsb;
import org.usb4java.Loader;
import qz.utils.SystemUtilities;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URL;