Skip to content

Instantly share code, notes, and snippets.

Tres Finocchiaro tresf

Block or report user

Report or block tresf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tresf
tresf / kz-1048.js
Last active Mar 19, 2020
Crude UTF-8 to KZ-1048 conversion
View kz-1048.js
/**
* Author: A. Tres Finocchiaro
* Date: 2020-03-18
* License: Public Domain
*/
// Crude UTF-8 to KZ-1048 conversion
const KZ_1048 = {
'Ђ' : '\x80', 'Ѓ' : '\x81', 'ѓ' : '\x83', '€' : '\x88', 'Љ' : '\x8A', 'Њ' : '\x8C', 'Қ' : '\x8D', 'Һ' : '\x8E', 'Џ' : '\x8F',
'ђ' : '\x90', 'љ' : '\x9A', 'њ' : '\x9C', 'қ' : '\x9D', 'һ' : '\x9E', 'џ' : '\x9F',
View gist:6ba5c1675f3e99849f202e01c3db18dd
// double-darkness hack, pass twice, offset by 1px
if(p == 0) {
offset += 1 * stripeWidth;
builder.append(new byte[] {0x1B, 0x4A, 0x01});
} else {
offset += 7 * stripeWidth;
builder.append(new byte[] {0x1B, 0x4A, 0x0F});
}
View macos_10.7.log
[WARN] 2020-03-04 12:47:18,411 @ qz.common.TrayManager:?
Could not load file: /Users/mac/Library/Application Support/qz/prefs.properties, reason: /Users/mac/Library/Application Support/qz/prefs.properties (No such file or directory)
WARNING: GL pipe is running in software mode (Renderer ID=0x1020400)
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextGetCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextSetBaseCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextGetCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextSetBaseCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextGetCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextSetBaseCTM: invalid context 0x0
Mar 4 12:47:20 Owners-Mac.local java[525] <Error>: CGContextGetCTM: invalid context 0x0
View Fongwah-qz.js
// Code backup 2020-02-27
// Fongwah UHF Reader WRD-130-U1
// QZ Tray 2.1.0
// Work in progress, not yet functional
function scanRFID() {
let vid = "0x0e6a";
let pid = "0x0317";
let usage = "0x0c";
View FongWah-dBm.js
// Calculate bits (most significant, least significant)
// **WARNING** Magic counting to follow:
// 1. MSB incriments when LSB hits 0x46 hex
// 2. Counting is done using decimal, BUT...
// 3. Decimal is strangly passed in hex format
var msb = parseInt(30 + Math.floor(((dBm + 2) + 30)/46), 16);
var lsb = parseInt(30 + ((dBm + 2) % 46), 16);
console.log("Setting power level to", dBm + "dBm = ", "MSB:", msb.toString(16), "LSB:", lsb.toString(16));
return qz.hid.sendData({
vendorId: vid,
View SizeByStage.java
// MIT License
// 2020 Tres Finocchiaro
import javafx.application.*;
import javafx.concurrent.Worker;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.*;
import javafx.scene.image.WritableImage;
import javafx.scene.transform.Transform;
import javafx.scene.web.WebView;
import javafx.stage.*;
View parentPermissions.java
public static void setPermissionsParentally(Path toTraverse, boolean worldWrite) {
Path stepper = toTraverse.toAbsolutePath();
// Assume we shouldn't go higher than top-level (e.g. "/etc")
while(stepper.getParent() != null && !stepper.getRoot().equals(stepper.getParent())) {
log.info("Processing {}", stepper);
File file = stepper.toFile();
file.setReadable(true, false);
file.setExecutable(true, false);
file.setWritable(true, !worldWrite);
if (SystemUtilities.isWindows() && worldWrite) {
View ResizeBeforeShow.java
import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.concurrent.Worker;
import javafx.embed.swing.SwingFXUtils;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javax.imageio.ImageIO;
View async_usage.js
qz.security.setSignaturePromise(async (toSign) => {
var pk = KEYUTIL.getKey(privateKey);
var sig = new KJUR.crypto.Signature({"alg": "SHA1withRSA"}); // Use "SHA1withRSA" for QZ Tray 2.0 and older
sig.init(pk);
sig.updateString(toSign);
var hex = sig.sign();
console.log("DEBUG: \n\n" + stob64(hextorstr(hex)));
return stob64(hextorstr(hex));
});
View lmms_cursor_crash.log
Process: LMMS [47638]
Path: /Users/USER/*/LMMS.app/Contents/MacOS/LMMS
Identifier: io.lmms
Version: 1.2.0.40 (1.2.0.40)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: LMMS [47638]
User ID: 501
Date/Time: 2020-01-29 14:15:49.716 -0500
You can’t perform that action at this time.