Skip to content

Instantly share code, notes, and snippets.

@kamituel
kamituel / index.html
Created February 12, 2016 09:08
Window opener in Safari
<html>
<head>
<script>
window.openPopup = function() {
window.open('popup.html', 'popup', 'height=200,width=200');
return false;
};
</script>
@kamituel
kamituel / ACEService.js
Created February 14, 2015 14:06
Fx Nightly friendly header
//tttconst DEBUG = false;
function debug(msg) {
//tttif (DEBUG) {
//ttt dump("ACEservice: " + msg + "\n");
//ttt}
console.log(msg);
}
//tttconst { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const { classes: Cc } = Components;
@kamituel
kamituel / gist:38ff7a926cdd96d69076
Last active August 29, 2015 14:14
Read file from app package with extracting to the filesystem first
let app = DOMApplicationRegistry.getAppByManifestURL(manifestURL);
if (!app) {
// handle
}
let appDir = FileUtils.getDir("coreAppsDir", ["webapps", app.id], false);
let appPackage = appDir.clone();
appPackage.append("application.zip");
let zipReader = Cc["@mozilla.org/libjar/zip-reader;1"]
@kamituel
kamituel / gist:0aaf13c6f329c559476c
Created January 26, 2015 13:13
Read file from app package without extracting to the filesystem
Cu.import("resource://gre/modules/FileUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
let app = DOMApplicationRegistry.getAppByManifestURL(manifestURL);
if (!app) {
// handle
}
@kamituel
kamituel / gist:44555971a0995aabaa8a
Created January 26, 2015 07:58
Sample DODF file.
A1 29
30 00
30 0F
0C 0D 47 50 20 53 45 20 41 63 63 20 43 74 6C
A1 14
30 12
06 0A 2A 86 48 86 FC 6B 81 48 01 0
30 04
04 02 42 00
I/Gecko ( 1485): ACEservice: Setting test dev cert hash A683...2128
I/Gecko ( 1485): [SUB0] QCONTENT_HELPER receiveMessage: 'RIL:IccOpenChannel'
I/Gecko ( 1485): [SUB0] QCONTENT_HELPER sendMessage to content process: RIL:IccOpenChannel { requestId : '{5bb68b09-40e0-4da9-8f8e-c44f77dd35a3}', errorMsg : null, channel : 2, }
I/Gecko ( 1485): -*- RILContentHelper: Received message 'RIL:IccOpenChannel': {"clientId":0,"data":{"requestId":"{5bb68b09-40e0-4da9-8f8e-c44f77dd35a3}","errorMsg":null,"channel":2}}
I/Gecko ( 1485): ACEservice: _openChannel/notifyOpenChannelSuccess: Channel 2 opened
I/Gecko ( 1485): ACEservice: _readODF
I/Gecko ( 1485): [SUB0] QCONTENT_HELPER receiveMessage: 'RIL:IccExchangeAPDU'
I/Gecko ( 1485): [SUB0] QCONTENT_HELPER sendMessage to content process: RIL:IccExchangeAPDU { requestId : '{ac11f446-deb1-41f2-956d-ae3c396bcbb1}', errorMsg : null, sw1 : 97, sw2 : 36, simResponse : null, }
I/Gecko ( 1485): -*- RILContentHelper: Received message 'RIL:IccExchangeAPDU': {"clientId
@kamituel
kamituel / index.html
Created December 9, 2014 13:06
Verify signature in JS using jsrasign library
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/sha256.js"></script>
<script src="ext/jsbn.js"></script>
@kamituel
kamituel / .profile
Created November 26, 2014 09:42
Bash profile
export EDITOR=vim
export VISUAL=$EDITOR
alias git-modified-by-me="git log --oneline --author=\"kamituel@gmail.com\" | awk '{ print $1; }' | xargs git show --pretty="format:" --name-only | sort | uniq"
alias pprint-json='python -mjson.tool'
alias adb_interesting="adb logcat | perl -ne 'print unless m{(E/Profiler|I/rmt_storage|D/wpa_supplicant|D/skia|./ALSADevice|D/alsa_ucm|D/DHCP|D/qdhwcomposer|./AudioHardwareALSA|D/AudioResourceManager|I/AutoMounter|./Sensors|E/mm-camera|./adsprpc|E/alsa_ucm|./MediaPlayerFactory|I/VolumeManager|./Vold|./CameraService|./mediaserver|./wcnss_service|./mm-camera-intf|WifiWorker component|./QCOM PowerHAL|./AudioFlinger|./AudioUsbALSA|./ALSAStreamOps|./AudioPolicyService|./EventHub|./InputReader|./nsVolume|./libEGL|./Adreno-EGL|./qdhwcomposer|./qdutils|./TrackUtils|./OMXMaster|./AudioUsbALSA)}'"
function find-grep {
find . -iname "$1" -exec grep -H "$2" '{}' \;
}
dupa:~ kls$ adb logcat -b radio
D/RIL ( 1577): [SUB0] [0078]< RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE {0}
D/RIL ( 1577): [SUB0] [UNSL]< RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED
D/RIL ( 1577): [SUB0] [0079]> RIL_REQUEST_OPERATOR
D/RIL ( 1577): [SUB0] [0080]> RIL_REQUEST_DATA_REGISTRATION_STATE
D/RIL ( 1577): [SUB0] [0081]> RIL_REQUEST_VOICE_REGISTRATION_STATE
D/RIL ( 1577): [SUB0] [0082]> RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE
D/RIL ( 1577): [SUB0] [0082]< RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE {0}
D/RIL ( 1577): [SUB0] [0081]< RIL_REQUEST_VOICE_REGISTRATION_STATE {12,(null),(null),0,(null),(null),(null),0,(null),(null),(null),(null),(null),0,(null)}
D/RIL ( 1577): [SUB0] [0080]< RIL_REQUEST_DATA_REGISTRATION_STATE {0,(null),(null),(null),0,20,(null),(null),(null),(null),(null)}
I/Gecko ( 3189): -*- FakeApi: Loading file.
I/Gecko ( 3189): -*- FakeApi: File loaded.
I/Gecko ( 3189): -*- FakeApi: Constructor
I/Gecko ( 3189): -*- FakeApi: Init.
I/Gecko ( 3189): -*- FakeApi: Openinig logical channel for app app://ace.gaiamobile.org/manifest.webapp
I/Gecko ( 2839): ACEservice: receiveMessage(): ACEService:IsAccessAllowed
I/Gecko ( 2839): ACEservice: icc provider
I/Gecko ( 2839): ACEservice: Is access allowed for app app://ace.gaiamobile.org/manifest.webapp
I/Gecko ( 2839): ACEservice: app is {"name":"ACE Helper","csp":"","installOrigin":"app://ace.gaiamobile.org","origin":"app://ace.gaiamobile.org","receipts":null,"installTime":1416608748473,"manifestURL":"app://ace.gaiamobile.org/manifest.webapp","appStatus":3,"removable":false,"id":"ace.gaiamobile.org","localId":1001,"basePath":"/system/b2g/webapps","progress":0,"installState":"installed","downloadSize":0,"updateTime":1416608748473,"installerAppId":0,"installerIsBrowser":false,"storeId":"","storeVersion":0,"role":"","re