Skip to content

Instantly share code, notes, and snippets.

View genecyber's full-sized avatar
🎯
Focusing

Shannon Code genecyber

🎯
Focusing
View GitHub Profile
[
{
"id": "e7d36084.182ca",
"type": "subflow",
"name": "Watch total received",
"info": "",
"in": [
{
"x": 517,
"y": 289,
@genecyber
genecyber / notes
Created September 9, 2015 17:12
Some bitcore SPV stuff
//Get output addresses from tx
tx.outputs.forEach(function(value, index){
try {
console.log(value._satoshis)
console.log(toAddress(value._script.toHex()))
} catch(e){
console.error(e)
}
})
@genecyber
genecyber / gist:da6e11c7d4588eb19a88
Created September 9, 2015 16:56
To DoubleSha256 or Scrypt in bitcore
BlockHeader.prototype._getHash = function hash() {
var buf = this.toBuffer();
//console.log("version",this.version, "is it?",this.version === 514 )
//console.log("Scrypt",BufferUtil.reverse(BufferUtil.scrypt(buf)).toString('hex'))//.reverse(buf.read(80)).toString('hex'))
if (this.version === 514) {
return BufferUtil.reverse(BufferUtil.reverse(BufferUtil.scrypt(buf)))
} else {
return Hash.sha256sha256(buf);
}
};
@genecyber
genecyber / ForkYou.Js
Last active July 1, 2016 13:14
Fork all repos for user into organization
var ForkYou = function(username, password, userToFork, forkIntoOrg, page) {
if (page === undefined) {
page = 1
}
var USER = userToFork
var ORG = forkIntoOrg
$.ajax({
url: "https://api.github.com/users/" + USER + "/repos?per_page=100&page=" + page
})
@genecyber
genecyber / example.js
Created May 29, 2015 14:07
Namespaced click binding
function bindClicks() {
/* Unbind by localnamespace (Awesome way to unbind a selective everything) */
$(document).unbind(".customBindings")
/* Join Chat */
$("a[href='#lobby']").bind("click.customBindings", function () {
joinLobby()
})
@genecyber
genecyber / continuous.js
Created May 13, 2015 18:40
Poor man's node continuous integration server (nodejs, git, github)
/*
*
* Authored by Shannon code to be my poor man's continuous integration.
* I use forever on the server combined with nodemon to moniror files for changes and restart them
* I have a webhook set in github that hits the below server /deploy upon every push
*
*/
var express = require('express')
var basicAuth = require('http-auth')
var java = require("java")
java.classpath.push("./lib/omnij-rpc-0.3-SNAPSHOT.jar")
java.classpath.push("./lib/omnij-core-0.3-SNAPSHOT.jar")
java.classpath.push("./lib/bitcoin-rpc-0.3-SNAPSHOT.jar")
java.classpath.push("./lib/bitcoinj-core-0.13-SNAPSHOT.jar")
java.classpath.push("./lib/slf4j-api-1.7.6.jar")
java.classpath.push("./lib/slf4j-jdk14-1.7.5.jar")
java.classpath.push("./lib/guava-16.0.1.jar")
java.classpath.push("./lib/jackson-core-2.3.3.jar")
java.classpath.push("./lib/jackson-databind-2.3.3.jar")
var levelup = require('levelup')
var db = levelup('./')
db.createReadStream()
.on('data', console.log)
.on('close', function () {
db.close()
})
@genecyber
genecyber / gist:f493a01d460618acd79a
Created April 15, 2015 16:57
read insight email store database
var levelup = require('levelup')
var db = levelup('./')
var collection = new Array()
var newCollection = new Array()
var sort_by = function(field, reverse, primer){
var key = primer ?
function(x) {return primer(x[field])} :
function(x) {return x[field]};
This would normally be a site with an input field to take input from the user of the watch being registered.