Skip to content

Instantly share code, notes, and snippets.

@pluswave
pluswave / alignment.patch
Created July 16, 2014 10:39
Quick and Dirty fix for alignment issue on ARM/MIPS platform for Webkit2/qt5.3.1
diff --git a/qtwebkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp b/qtwebkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
index 43246f4..bdbc2f1 100644
--- a/qtwebkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
+++ b/qtwebkit/Source/WebKit2/Platform/CoreIPC/ArgumentEncoder.cpp
@@ -61,17 +61,18 @@ PassOwnPtr<ArgumentEncoder> ArgumentEncoder::create()
}
ArgumentEncoder::ArgumentEncoder()
- : m_buffer(m_inlineBuffer)
- , m_bufferPointer(m_inlineBuffer)
@pluswave
pluswave / backtrace
Created July 16, 2014 10:59
GDB backtrace for QtWebProcess SIGBUS
(gdb) bt
#0 0x451ffe1c in qt_memfill32 (dest=0x4b619000, value=4294967295, count=512) at painting/qdrawhelper_neon.cpp:68
#1 0x450fb74c in qt_memfill<unsigned int> (dest=0x4b619000, color=4294967295, count=512)
at ../../include/QtGui/5.3.1/QtGui/private/../../../../../src/gui/painting/qdrawhelper_p.h:702
#2 0x45106088 in blend_color_argb (count=1, spans=0xbedbc924, userData=0x95b30) at painting/qdrawhelper.cpp:4448
#3 0x4515c9a0 in qt_span_fill_clipRect (count=256, spans=0xbedbc134, userData=0x95b30)
at painting/qpaintengine_raster.cpp:4075
#4 0x451bd004 in QSpanBuffer::flushSpans (this=0xbedbc134) at painting/qrasterizer.cpp:113
#5 0x451bcfa4 in QSpanBuffer::addSpan (this=0xbedbc134, x=0, len=512, y=255, coverage=255 '\377')
at painting/qrasterizer.cpp:107
@pluswave
pluswave / shm_mmap_test.c
Created July 18, 2014 11:14
odd SIGBUS
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int fileDescriptor;
@pluswave
pluswave / test.xhtml
Created August 1, 2014 10:36
not work on chromium, but works on firefox (however, keyCode is wrong)
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>DocumentKeyTest</title>
<script>
function load(){
@pluswave
pluswave / KitKatPrinter.java
Last active August 29, 2015 14:05
KItKatPrinter plugin for cordova
package org.xiaofuxing.name;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CallbackContext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.Runnable;
import android.print.PrintJob;
@pluswave
pluswave / update-plugin.js
Last active September 21, 2015 10:11
why not ionic plugin update ? so my own solution here.
#!/usr/bin/env node
var fs = require('fs');
var child_process = require('child_process');
if( process.argv.length != 3 ){
console.log("usage: " + process.argv[1] + " packagename");
process.exit(1);
}
@pluswave
pluswave / youban_mp3_tangshi.js
Created March 29, 2016 13:30
youban.com 专用MP3爬虫
#!usr/bin/env node
var jsdom = require('jsdom');
function lists(window){
var as = window.document.body.querySelectorAll("#topicListern a");
as = Array.prototype.slice.call(as, 0);
// console.log(JSON.stringify(as));
@pluswave
pluswave / ecg_chart.py
Last active July 16, 2018 01:32
基于matplotlib输出心电图纸到pdf文件
#*-- coding: utf-8 --*
import matplotlib
X_INCH = 7
Y_INCH = 11
X_MM = int(X_INCH*25.4)
Y_MM = int(Y_INCH*25.4)
while X_MM % 5 != 1:
@pluswave
pluswave / tplink-redial.js
Last active September 24, 2016 06:31
使用Phontamjs (2.1)模拟,让TPLINK路由器(WVR458G)重新拨号
@pluswave
pluswave / rename.js
Created December 17, 2016 14:14
重命名一组视频文件,去掉前面重复的头,中文序号变为标准3个阿拉伯数字序号
var chnNumChar = {
零:0,
一:1,
二:2,
三:3,
四:4,
五:5,
六:6,
七:7,
八:8,