Skip to content

Instantly share code, notes, and snippets.

Avatar

Tres Finocchiaro tresf

View GitHub Profile
@tresf
tresf / qz-sha256.js
Last active Sep 21, 2021
A version of sha256 that won't break with non-UTF8 web pages
View qz-sha256.js
/*!
* @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 Aug 16, 2021
ExtWinGDI.java
View 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 Aug 16, 2021
ExtUser32.java
View 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 Aug 13, 2021
Usb4Java Static Library Path Shim
View LoaderShim.java
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;
View HelloFX.java
// javac -p path/to/fx/lib --add-modules javafx.web -cp . HelloFX.java
// java -p path/to/fx/lib --add-modules javafx.web -cp . HelloFX
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.web.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
View sha1.log
https://stackoverflow.com/questions/29941362/
[ERROR] 2021-08-11 11:09:30,361 @ qz.auth.Certificate:?
Unable to verify signature
java.security.SignatureException: Signature encoding error
at sun.security.rsa.RSASignature.engineVerify(RSASignature.java:226)
at java.security.Signature$Delegate.engineVerify(Signature.java:1394)
at java.security.Signature.verify(Signature.java:771)
at qz.auth.Certificate.isSignatureValid(Unknown Source)
at qz.ws.PrintSocketClient.validSignature(Unknown Source)
View Building JSSC on Mac.md
  1. Install MacOS 10.15.7 Catalina in an Intel Virtual Machine
  2. Install XCode Command Line tools
    xcode-select --install
  3. Extract Xcode_12.4.xip (this can take while)
  4. Copy newly extracted XCode.app to /Applications
  5. Download Xcode_6.2.dmg, XCode (right click), Show package contents
  6. Browse to Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs and copy to /Library/Developer/CommandLineTools/SDKs
  7. Accept the xcodebuild license
@tresf
tresf / add-update-github-access-token-on-mac.md
Last active Jul 28, 2021 — forked from jonjack/add-update-github-access-token-on-mac.md
Adding & Updating GitHub Access Token on Mac
View add-update-github-access-token-on-mac.md

As outlined here, there are a couple of situations where you may want/need to authenticate with GitHub by using an Access Token:-

  1. If you have Two-Factor Authentication (2FA) enabled.
  2. You are accessing an organisations protected content using SAML Single-Sign On (SSO).

Using an Access Token for the first time

Create an Access Token

In your GitHub account, go to Settings / Developer settings / Personal access tokens and select Generate New Token. Make a note of the token somewhere safe since this is the only chance you get to see it.

View qz_hid_scale.html
<script src="https://unpkg.com/qz-tray"></script>
<script src="https://unpkg.com/qz-sift"></script>
<label for="lb">lb: </label><input id="lb" type="text" readonly/>
<label for="oz">oz: </label><input id="oz" type="text" readonly/>
<script>
// The callback code when a response is received
qz.hid.setHidCallbacks(function (event) {
if(event.type === 'RECEIVE') {
View dmg.sh
#!/bin/bash
# Downloads, extracts and bundles the JDK into a runnable DMG for MacOS
#
# Dependencies:
# homebrew
# brew install node
# npm install -g appdmg
# xcode 12.0+
# command line utilities