This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function emptyLoad(target){ | |
function lookup(){ | |
if (ready) ready = false; | |
target.once((data) => { | |
if (data) { | |
clearInterval(checkInterval); | |
}else{ | |
ready = true; | |
lookup() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
const path = require('path'); | |
const fs = require('fs'); | |
var listen_path = path.join(process.cwd(), 'gun_sockets'); | |
if (!fs.existsSync(listen_path)) { | |
fs.mkdirSync(listen_path); | |
} | |
listen_path = path.join(listen_path, 'gun.socket'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const net = require('net'); | |
const path = require('path'); | |
var listen_path = path.join(process.cwd(), 'nodejs.socket'); | |
if (process.platform.indexOf("win") > -1) | |
listen_path = path.join('\\\\?\\pipe', process.cwd(), 'nodejs.socket'); | |
module.exports = { | |
server: function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Gun = require('gun/gun'); | |
Gun.on('create', function lg(root) { | |
this.to.next(root); | |
const CyclicDb = require("@cyclic.sh/dynamodb") | |
const db = CyclicDb(process.env.CYCLIC_DB); | |
const COLLECTION = "gun2"; | |
const collection = db.collection(COLLECTION); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const s3_bucket = process.env.AWS_BUCKET; | |
const s3_region = process.env.AWS_REGION; | |
(async function () { | |
const { | |
S3Client, | |
ListObjectsCommand, | |
GetObjectCommand, | |
PutObjectCommand, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(pwd, extra) { | |
var forge = require("node-forge"); | |
forge.options.usePureJavaScript = true; | |
var EC = require('elliptic').ec; | |
return new Promise((resolve, reject) => { | |
var ec_p256 = new EC('p256'); | |
if (!pwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
modprobe libcomposite | |
command="$1" # "up" or "down" | |
gadgetDevice="/sys/kernel/config/usb_gadget/my_gadget" | |
usb_up() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* NOTE: Does not work with npm installed heroku-cli | |
* | |
* Heroku CLI REQUIRED! Uninstall with: npm uninstall heroku -g | |
* Install Heroku with: curl https://cli-assets.heroku.com/install.sh | sh | |
* Login Heroku with: heroku login | |
* | |
* after login you can run test | |
* like: $ mocha test/bug/1243.js | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitHex = 8; | |
//idea is that when a pub key gets created, the user stores this int32 in its profile. | |
//then when you go to fetch the list of pubkeys, hash the key and also fetch the int32 from the profile | |
//compair the alias + int32 and show the user profile(s) to the requesting user for decision | |
//when user has decided save the pubkey and any other meta data you wish | |
var sha256_toint_test = "something like a publickey that has a reference of the output int32"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(gun) { | |
function $gun(last) { | |
var self = this; | |
if (last) { | |
self.last = last; | |
self.root = last.root; | |
} | |
else { | |
self.user = function(user) { | |
var _user = new $gun(); |
NewerOlder