Skip to content

Instantly share code, notes, and snippets.

View penk's full-sized avatar

Penk Chen penk

View GitHub Profile
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 {
#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>
#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
--- /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
$ cat test.swift
cat test.swift
func quicksort_swift(inout a:[CInt], start:Int, end:Int) {
if (end - start < 2){
return
}
var p = a[start + (end - start)/2]
var l = start
var r = end - 1
@penk
penk / 8comic.js
Created October 2, 2014 07:26
8comic downloader written in casperjs
// Usage: casperjs 8comic.js http://new.comicvip.com/show/cool-1050.html
var casper = require('casper').create({
pageSettings: {
webSecurityEnabled: false
}
});
var pages, currentPage;
@penk
penk / unityscreenshot
Created August 21, 2014 08:31
Take screenshot from Ubuntu Touch
#!/bin/sh
set -e
D=$(date +"%Y%m%d%H%M%S")
size=$(adb shell "fbset|sed -n -e's/^mode.*\"\([0-9]\+x[0-9]\+\)[-\"].*$/\1/p'")
adb shell mirscreencast -m /var/run/mir_socket -n 1 -f /tmp/${D}.rgba
adb pull /tmp/${D}.rgba
/opt/ImageMagick/bin/convert -depth 8 -size $size ${D}.rgba ~/Desktop/${D}.png
/bin/rm ${D}.rgba
#qlmanage -p ~/Desktop/${D}.png >& /dev/null &
@penk
penk / material-design.qml
Last active January 19, 2019 22:36
Material Design inspired style in QML
import QtQuick 2.0
import QtGraphicalEffects 1.0
Rectangle {
id: root
color: '#EEEEEE'
width: 960
height: 768
Item {
@penk
penk / manifest.json
Last active August 29, 2015 14:02
Click package manifest example
{
"description": "SlateKit Shell",
"framework": "ubuntu-sdk-14.04",
"hooks": {
"slatekit-shell": {
"apparmor": "slatekit-shell.json",
"desktop": "slatekit-shell.desktop"
}
},
"maintainer": "Penk Chen <penkia@gmail.com>",
@penk
penk / main.cpp
Last active June 29, 2021 23:25
minimal QtWebEngine example
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtWebEngine/qtwebengineglobal.h>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QtWebEngine::initialize();
QQmlApplicationEngine appEngine;
appEngine.load(QUrl("main.qml"));