Skip to content

Instantly share code, notes, and snippets.

Ping-Hsun "penk" Chen penk

Block or report user

Report or block penk

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
View web.qml
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 Nov 27, 2018
Reusing Qt virtual keyboard's existing input method from actual keyboard PoC
View userscript.js
(function () {
window.addEventListener("keypress", function (e) {
console.log('keypress:'+String.fromCharCode(e.keyCode));
e.preventDefault();
}, false);
})();
View gist:b3b54b060f6378b4d000412f8f346fc6
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) {
View webview-size-comparison.md

Size of Oxide 1.19.6-0ubuntu0.16.04.1+overlay1

penk@abulafia:~/armhf-rootfs$ du -h ./usr/lib/arm-linux-gnueabihf/libOxideQtCore.so.0 
51M	./usr/lib/arm-linux-gnueabihf/libOxideQtCore.so.0

penk@abulafia:~/armhf-rootfs$ du -h ./usr/lib/arm-linux-gnueabihf/oxide-qt
420K	./usr/lib/arm-linux-gnueabihf/oxide-qt/chromium_l10n
23M	./usr/lib/arm-linux-gnueabihf/oxide-qt

Size of QtWebEngine 5.7.1

@penk
penk / init-volatile-log.patch
Created Dec 16, 2016
Add volatile-log boot parameter for mounting /var/log as tmpfs
View init-volatile-log.patch
commit 8f43fd71173f6da79b5029343e35285c8800a1de
Author: Penk Chen <penkia@gmail.com>
Date: Fri Dec 16 11:47:03 2016 +0000
Add volatile-log boot param
diff --git a/init b/init
index 43f1571..bb7f995 100755
--- a/init
+++ b/init
@penk
penk / uEnv.txt
Created Dec 10, 2016
Custom bootscript to boot Ubuntu Core from USB on RPi2/3
View uEnv.txt
snap_core=core_584.snap
snap_kernel=pi2-kernel_24.snap
snappy_usb_boot=run loadfiles; setenv mmcroot "/dev/sda2 ${snappy_cmdline} snap_core=${snap_core} snap_kernel=${snap_kernel}"; run mmcargs; bootz ${loadaddr} ${initrd_addr}:${initrd_size} 0x02000000
loadinitrd=load usb ${mmcdev}:${mmcpart} ${initrd_addr} ${snap_kernel}/${initrd_file}; setenv initrd_size ${filesize}
loadkernel=load usb ${mmcdev}:${mmcpart} ${loadaddr} ${snap_kernel}/${kernel_file}
uenvcmd=echo USB-BOOT; run usb_boot; run snappy_usb_boot
View webview.qml
import QtQuick 2.0
import QtWebKit 3.0
import QtQuick.Window 2.2
// DISPLAY=:0.0 qmlscene webview.qml
Window {
width: Screen.width
height: Screen.height
TextInput {
View plugin.cpp
#include <fstream>
#include <jpeglib.h>
#include <setjmp.h>
#include <QDebug>
#include <QtQml/qqml.h>
#include <QtQml/QQmlExtensionPlugin>
#include <QDir>
#include <tensorflow/core/framework/graph.pb.h>
#include <tensorflow/core/framework/tensor.h>
View SPHERICALBOT.ino
#include <SoftwareSerial.h>
#include <Servo.h>
// Bluetooth(RX, TX),
// RX and TX pins on Arduino board.
SoftwareSerial Bluetooth(10, 11);
Servo servoTurn;
Servo servoMove;
#define MAX_UARTCMDLEN 128
View hack_install_py.patch
--- /usr/lib/python3/dist-packages/click/install.py.old 2016-01-12 19:05:39.000000000 +0000
+++ /usr/lib/python3/dist-packages/click/install.py 2016-01-12 19:07:08.000000000 +0000
@@ -418,7 +418,8 @@
for dirpath, dirnames, filenames in os.walk(inst_dir):
for entry in dirnames + filenames:
entry_path = os.path.join(dirpath, entry)
- entry_mode = os.stat(entry_path).st_mode
+ if os.path.exists(entry_path):
+ entry_mode = os.stat(entry_path).st_mode
new_entry_mode = entry_mode | stat.S_IRGRP | stat.S_IROTH
You can’t perform that action at this time.