Skip to content

Instantly share code, notes, and snippets.

@kamituel
kamituel / gpd-example-1
Created November 5, 2014 08:48
GPD example #1 parsed to proposed data structure
[
{
"applet": [
160,
0,
0,
1,
81,
1
],
@kamituel
kamituel / seapi.js
Last active August 29, 2015 14:06
SE API usage example
var openSession = function(readers) {
var seReader = readers.filter(function(reader) {
return reader.type === 'uicc';
})[0];
if (!seReader) {
return Promise.reject('No suitable SE found');
}
return seReader.openSession();
@kamituel
kamituel / Vagrantfile
Last active August 29, 2015 13:59
Vagrant file for Firefox OS builds. Based on yzen work (https://gist.github.com/yzen/7723421), but updated with missing packages, X support and instructions how to workaround Mac OS filesystem's case insensitivity.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# To use this script and prepare your build environment, run the following
# command in the same directory as the Vagrantfile.
# B2G_PATH={path to your B2G directory} vagrant up
# NFS file system is case insensitive. This will make B2G build to fail.
# To avoid this:
# (host-mac): hdiutil create -volname 'firefoxos' -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/firefoxos.sparseimage
@kamituel
kamituel / layout.html
Created April 11, 2014 18:33
B2G - Buildbot. Put files into right directories: master/master.cfg; ./restart.sh; ./start.sh; master/templates/root.html; master/templates/layout.html. Install Buildbot (tutorial: http://kamituel.tumblr.com/tagged/Buildbot).
{%- block doctype -%}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{% endblock %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
{% block head %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
{% if metatags %}
{{ metatags }}
@kamituel
kamituel / gist:8096458
Created December 23, 2013 12:40
Object as an array indice.
var array = ['a', 'b', 'c'];
var obj = {
toString: function() {
return "1";
}
};
// array[obj] === 'b'
@kamituel
kamituel / index.html
Created September 27, 2013 08:17
Steps to reproduce bug in Casper.js
<!doctype html>
<html>
<body>
<button id="indexBtn">Open popup</button>
<script>
document.querySelector('button').addEventListener('click', openPopup);
function openPopup () {
window.open('popup.html', 'name', 'width=750, height=300');
@kamituel
kamituel / create_replica_set.sh
Created September 18, 2013 17:36
Bash script to create MongoDB replica set.
#!/bin/sh
MONGO=../mongo/bin
NUMBER_OF_NODES=$1
REPLICA_NAME=rs
PORT=27017
if [[ -z "$1" ]];
then
NUMBER_OF_NODES=3
@kamituel
kamituel / gist:6611870
Created September 18, 2013 16:39
Create two shards with replica set of 3 nodes in Mongo (windows BAT file, but probably easly changeable to .sh)
REM Andrew Erlichson - Original author
REM Jai Hirsch - Translated original .sh file to .bat
REM 10gen
REM script to start a sharded environment on localhost
echo "del data files for a clean start"
del /Q c:\data\config
del /Q c:\data\shard0
@kamituel
kamituel / Procfile
Last active December 22, 2015 23:39
Open API USSD handling (Heroku)
web: node app.js
@kamituel
kamituel / GpxParser.java
Last active July 13, 2017 09:58
Parsing GPX files (Android compatible).
package pl.kamituel.gpx;
import java.io.IOException;
import java.io.InputStream;
public class GpxParser {
private InputStream mIs = null;
private StringBuilder mStringBuilder = new StringBuilder();
public GpxParser (InputStream is) {