Skip to content

Instantly share code, notes, and snippets.

Avatar

Penk Chen penk

View GitHub Profile
View hackeglfs.patch
diff -ru qtbase-opensource-src-5.0.0-beta1/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp qtbase-opensource-src-5.0.0-beta1-hackeglfs/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
--- qtbase-opensource-src-5.0.0-beta1/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp 2012-08-28 21:40:54.000000000 +0200
+++ qtbase-opensource-src-5.0.0-beta1-hackeglfs/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp 2012-10-06 14:50:22.748034778 +0200
@@ -130,7 +130,20 @@
QSurfaceFormat QEglFSHooks::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
{
- return inputFormat;
+ QSurfaceFormat newFormat = inputFormat;
+ QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH");
@penk
penk / manifest.json
Last active Aug 29, 2015
Click package manifest example
View manifest.json
{
"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 / 8comic.js
Created Oct 2, 2014
8comic downloader written in casperjs
View 8comic.js
// Usage: casperjs 8comic.js http://new.comicvip.com/show/cool-1050.html
var casper = require('casper').create({
pageSettings: {
webSecurityEnabled: false
}
});
var pages, currentPage;
View comic_leech.pl
#!/usr/bin/env perl
# comic_leech.pl - download comic from comic8.com
# example: ./comic_leech.pl http://www.586it.com/type/type-103.html 580-582
# this will fetch 海賊王 from vol.580 to vol.582
use File::Basename;
if ( ! $ARGV[0] ) {
print "Usage: $0 <URL> [<VOL>]\n";
} else {
View NPN_Evaluate
sprintf(buffer,
"if ($('#'+%d.length != 0) { $('#'+%d.remove(); }", This->id, This->id );
if( NPERR_NO_ERROR == NPN_GetValue(instance, NPNVWindowNPObject, &plugin) )
{
NPString script;
script.utf8characters = buffer;
script.utf8length = strlen(script.utf8characters);
NPVariant result;
@penk
penk / gist:650743
Created Oct 28, 2010
JSEvaluateScript
View gist:650743
WebKitWebFrame *frame;
frame = webkit_web_view_get_main_frame(WEBKIT_WEB_VIEW (web_view));
JSGlobalContextRef context = webkit_web_frame_get_global_context(frame);
JSStringRef script = JSStringCreateWithUTF8CString("console.log('test');");
JSEvaluateScript(context, script, 0, 0, 0, 0);
View keyboard-layout.txt
iPad bopomofo:
ㄅ ㄉ ˇ ˋ ㄓ ˊ ˙ ㄚ ㄞ ㄢ ㄦ ←
ㄆ ㄊ ㄍ ㄐ ㄔ ㄗ ㄧ ㄛ ㄟ ㄣ 、 ,
ㄇ ㄋ ㄎ ㄑ ㄕ ㄘ ㄨ ㄜ ㄠ ㄤ Enter
_ ㄈ ㄌ ㄏ ㄒ ㄖ ㄙ ㄩ ㄝ ㄡ ㄥ 。
SYM ALT Space SYM ↓
iPad changjie:
View hijack_android.sh
#!/bin/busybox sh
mount -o remount,rw /
mount -o remount,rw /system
mkdir -p /mnt/rootfs
mkdir -p /var/log /tmp /run
mv /system/bin/app_process /system/bin/app_process.bak
cp -ap /mnt/rootfs/etc/X11 /etc
killall zygote
killall bootanimation
View gist:5bc51d7305e45ebeb057
$ 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
View start-slatekit.sh
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
export QT_QWS_FONTDIR=/usr/share/fonts/truetype/droid/
if [ ! -e /dev/fb0 ]; then
/bin/ln -s /dev/graphics/fb0 /dev/fb0
fi
export TSLIB_FBDEVICE=/dev/graphics/fb0
export TSLIB_CONFFILE=/etc/ts.conf