Skip to content

Instantly share code, notes, and snippets.

var toxcore = require('toxcore');
// Create a default Tox instance
var tox = new toxcore.Tox();
// Try to load our tox file
tox.loadFromFile('my.tox', function(err) {
if(!err) {
console.log('Loaded from file successfully');
} else {
@mattcollier
mattcollier / thstiming.js
Created March 24, 2015 13:33
signalReload can't be called immediately after createHiddenService/saveConfig
var fs = require('fs');
var dataDir = __dirname + '/demo-data';
rmDir = function(dirPath) {
console.log('Removing:', dirPath);
try { var files = fs.readdirSync(dirPath); }
catch(e) { console.log(e); return; }
if (files.length > 0)
for (var i = 0; i < files.length; i++) {
var filePath = dirPath + '/' + files[i];
matt@matt-Lenovo-G560-Jessie:~/noxious$ ./build_x64.sh
gyp info it worked if it ends with ok
gyp info using pangyp@2.1.0
gyp info using node@1.6.3 | linux | x64
gyp info spawn python
gyp info spawn args [ '/home/matt/iojs/lib/node_modules/pangyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
<!DOCTYPE html>
<html>
<head>
<script>
var atomRemote = require('remote');
var sprintf = require('sprintf-js').sprintf;
</script>
<script src='js/forge.bundle.js'></script>
<script>
var rsa = forge.pki.rsa;
@mattcollier
mattcollier / issue-description
Created April 17, 2015 12:16
Atom-shell integration with forge module
I'm attempting to get the [forge module](https://github.com/digitalbazaar/forge) to work with [atom-shell](https://github.com/atom/electron/).
Forge module mods:
https://github.com/mattcollier/forge/blob/master/js/prng.js#L23
Atom-shell renderer code
https://gist.github.com/mattcollier/3a713b4a076cd65257fe
The code as shown allows one to utilize webworkers while still getting a CSPRNG from io.js via openssl.
@mattcollier
mattcollier / description.md
Created April 17, 2015 12:18
Integrate forge module with atom-shell
@mattcollier
mattcollier / variablescope.js
Created April 25, 2015 12:38
variablescope
var bootstrapProgress = 0;
controlClient.on('data', function(data){
data = data.toString();
if (torControlMessageHandler) torControlMessageHandler(data.toString());
if (data.search(/250-status\/bootstrap-phase/) >= 0) {
var bootstrapPhase = extractBootstrap2(data);
if (bootstrapPhase.progress < 100) {
setTimeout(bsStatus, 250);
}
console.log('new:', bootstrapPhase.progress, 'old:', bootstrapProgress);
@mattcollier
mattcollier / es6class.js
Created April 26, 2015 21:42
ES6 Class Example
"use strict";
var net = require('net');
class TorControlClient {
constructor() {
this.torHost = '127.0.0.1';
this.torControlPort = 9998;
this.torControlPassword = 'torControl2015';
this.initialized = false;
@mattcollier
mattcollier / gist:095567e70219b94b221b
Last active August 29, 2015 14:23
Claim Group Vocab
{
"id": "email",
"type": "Property",
"label": "Email Address",
"range": "String",
},
{
"id": "claim",
"type": "Property",
"range": "URL",
@mattcollier
mattcollier / gist:6e2d29ee44bbf9fc2b21
Last active August 29, 2015 14:25
Correct sinon usage?
'use strict';
var sinon = require('sinon');
var request = require('request');
describe('standalone-issuer', function() {
var rPost;