Skip to content

Instantly share code, notes, and snippets.

View tresf's full-sized avatar

Tres Finocchiaro tresf

View GitHub Profile
@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;
@tresf
tresf / HelloFX.java
Created August 11, 2021 14:19
HelloFX
// 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;
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)
  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 July 28, 2021 17:22 — forked from jonjack/add-update-refresh-github-access-token-on-mac.md
Adding & Updating GitHub Access Token on Mac

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.

<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') {
#!/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
@tresf
tresf / HelloGUI.java
Last active October 10, 2022 22:34 — forked from 0x000000AC/HelloGUI
Hello World using the JOptionPane
/***********************************************
* HelloGUI.java
* Aaron P. Clark, A. Tres Finocchiaro
***********************************************/
import javax.swing.*;
public class HelloGUI {
public static void main(String ... args) throws Throwable {
SwingUtilities.invokeAndWait(() -> JOptionPane.showMessageDialog(null, "Hello, World!"));
}
@tresf
tresf / DealingWithModules.sh
Last active May 6, 2021 03:48
java_fx_hell
# Edit Configuration, Modify Options, VM Options
--add-modules
javafx.web,javafx.graphics,javafx.controls,javafx.fxml,javafx.base
--add-opens
javafx.web/javafx.scene.web=ALL-UNNAMED
--add-opens
javafx.graphics/com.sun.javafx.sg.prism=ALL-UNNAMED
--add-exports
javafx.graphics/com.sun.javafx.scene=ALL-UNNAMED
# Search all binary executable files
FILES_TO_SIGN=$(
for f in `find "${INPUT_DIRECTORY}" -type f`; do
file $f | grep "Mach-O" | grep -v "Mach-O 64-bit object" | cut -f 1 -d \: | cut -f 1 -d \ | uniq
done
)
for FILE in $FILES_TO_SIGN; do
codesign -f --timestamp -o runtime --entitlements entitlements.list -s "$APPID" -fvvv $FILE
done