Skip to content

Instantly share code, notes, and snippets.

View penk's full-sized avatar

Penk Chen penk

View GitHub Profile
@penk
penk / cura-2-wall-vase.patch
Created August 16, 2026 12:00
2-wall vase mode for Cura
diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json
index 6601d5c..0a21abe 100644
--- a/resources/definitions/fdmprinter.def.json
+++ b/resources/definitions/fdmprinter.def.json
@@ -1097,7 +1097,7 @@
"description": "The thickness of the walls in the horizontal direction. This value divided by the wall line width defines the number of walls.",
"unit": "mm",
"default_value": 0.8,
- "value": "wall_line_width_0 if magic_spiralize else 0.8",
+ "value": "wall_line_width_0 + (magic_spiralize_wall_count - 1) * wall_line_width_x if magic_spiralize else 0.8",
@penk
penk / block-unwanted-post.js
Created January 8, 2025 03:00
Block unwanted post on facebook
// Helper to find parent element matching a condition
function findParentMatching(element, condition, maxDepth = 10) {
let current = element;
let depth = 0;
while (current && depth < maxDepth) {
if (condition(current)) {
return current;
}
current = current.parentElement;
@penk
penk / keyboard.json
Last active April 15, 2026 01:57
QMK firmware for Toshiba T1200
{
"keyboard_name": "toshiba_t1200",
"manufacturer": "Toshiba",
"url": "",
"maintainer": "penk",
"usb": {
"vid": "0xFEED",
"pid": "0x0000",
"device_version": "1.0"
},
diff --git a/src/Makefile b/src/Makefile
index 182dd0c..ed34a08 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,8 +1,8 @@
-include Makefile.local
-CC_NATIVE ?= gcc
-CXX_NATIVE ?= g++
-LD_NATIVE ?= g++
@penk
penk / README.md
Last active October 16, 2024 22:31

How to work with x86_64 binaries in the ARM64 Linux VM on top of M1 macOS Host

Let's take Qt online installer and Qt Creator as an example.

Requirements

At the time of this writing:

#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <wiringSerial.h>
#define UART_NODE "/dev/ttyS0"
enum KEY_TYPE {
SHORT_PRESS = 1,
MIDDLE_PRESS = 2,
@penk
penk / build-qtwebengine-6.2.0-pi4-arm64.md
Last active October 2, 2021 14:34
Build QtWebEngine 6.2.0 on Raspberry Pi 4 for arm64
import QtQuick 2.0
import QtQuick.Window 2.0
import QtWebEngine 1.0
import QtQuick.VirtualKeyboard 2.2
import QtQuick.VirtualKeyboard.Settings 2.2
Window {
width: Screen.width
height: Screen.height
visible: true
@penk
penk / userscript.js
Last active November 27, 2018 05:33
Reusing Qt virtual keyboard's existing input method from actual keyboard PoC
(function () {
window.addEventListener("keypress", function (e) {
console.log('keypress:'+String.fromCharCode(e.keyCode));
e.preventDefault();
}, false);
})();
QString QQuickLoader::errorString() const
{
Q_D(const QQuickLoader);
QString ret;
if(d->component->errors().isEmpty())
return ret;
if (d->component && d->component->isError()) {
const QList<QQmlError> errorList = d->component->errors();
for (const QQmlError &e : errorList) {