Skip to content

Instantly share code, notes, and snippets.


Alan K modeswitch

  • Brainsights
  • Toronto
View GitHub Profile
View app.js
const express = require("express");
let app = express();
let basicAuth = require("express-basic-auth");
users: {
"brainsights": "donthackus",
challenge: true,
View gist:89d054989405a12813bc
/* creates a data channel between two peer connections and sends binary messages
* after ~4000 messages it will segfault
* reproducible with nodejs-0.10.31 & wrtc-0.0.29
var servers = null, options = {optional: [{DtlsSrtpKeyAgreement:true}]};
var rx, tx, tx_channel;
/* receiving peer */
View gist:1f8dc018331b625c7431
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at */
function test() {
let local = {};
Components.utils.import("resource://gre/modules/CloudSync.jsm", local);
Components.utils.import("resource:///modules/sessionstore/TabState.jsm", local);
View app.js
var dgram = require('dgram');
var path = require('path');
var express = require('express');
var EventEmitter = require('events').EventEmitter;
var app = express();
var port = process.env.PORT = 9080;
var router = express.Router();
var socket = dgram.createSocket('udp4');
var scanEvents = new EventEmitter();

Importing the JS module

console.log(cloudSync); // Module is imported


modeswitch / gist:114c9bd55d800df242a2
Last active Jun 19, 2020
Building Node.js for Anddoid
View gist:114c9bd55d800df242a2

Before you begin

Make sure you have adb installed and that it works. Test this by connecting your phone and running adb devices. In order to proceed past the build stage, your device must be rooted. The device I used is running Cyanogenmod with root enabled for both apps and adb.


Fetch the Android NDK

You'll need to get the Android NDK. I used r8e, which you can get from here: Make sure you get the x86 version, as the x86_64 version will not help you. Let's call the path where you unpack this NDK_PATH.

View gist:6143221b112c939de077
Server running at
ws connected
WebRtc VoiceEngine codecs:
ISAC/16000/1 (103)
ISAC/32000/1 (104)
Warning( Unexpected codec: ISAC/48000/1 (105)
PCMU/8000/1 (0)
View gist:9916280
let service = Cc[";1"]
service.whenLoaded().then(() => {
// Cloudsync is ready, do work; // local device id
View cloudsync.diff
diff --git a/services/cloudsync/CloudSync.js b/services/cloudsync/CloudSync.js
new file mode 100644
index 0000000..8bdff6b
--- /dev/null
+++ b/services/cloudsync/CloudSync.js
@@ -0,0 +1,71 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at */
View gist:9499568
Filer Roadmap:
* ~~Support Brackets, and other applications~~
* Support for DropBox and other clouds
* Shared cross-domain storage and API
* DropBox clone that isn't in the cloud
* Proxy API for postMessage into an iframe
* JavaScript lib that you include which handles proxy communication
* HTML page that can be put in an iframe to give a common domain (
* `<script src="">` that 3rd parties can use to have a shared filesystem
You can’t perform that action at this time.