Skip to content

Instantly share code, notes, and snippets.

View assafshomer's full-sized avatar

Assaf Shomer assafshomer

View GitHub Profile
@assafshomer
assafshomer / addr.js
Created March 13, 2016 12:06
bitcoinjs-lib addresses and network selection
var bitcoin = require('bitcoinjs-lib')
var net = function(network) {
tmp = (network == 'testnet') ? bitcoin.networks.testnet : bitcoin.networks.bitcoin;
return tmp;
};
network = 'bitcoin'
var key = bitcoin.ECPair.makeRandom({network: net(network)});
var bitcoinAddress = key.getAddress(net(network)).toString();
var privateKeyWif = key.toWIF();
@assafshomer
assafshomer / op.js
Created March 10, 2016 11:57
bitcoinjs-lib op_return
wif='cNXxHLQwuzaLX7Z3apfSSEUDPPrQtUrwyzuaEZZakk2uWCcDS1Uo'
address='miq6AWvTYZJ63hJfh1W7zozHAf1URDv5pS'
unspent_txid = '067aabe97ff2e8051527d7f378266d046fd8e4c66e5b7dd671ec4e86b8a68cbb'
unspent_vout = 0
keyPair = bitcoin.ECPair.fromWIF(wif,network)
var txb = new bitcoin.TransactionBuilder(network)
var data = new Buffer('assafshomer')
var dataScript = bitcoin.script.nullDataOutput(data)
txb.addInput(unspent_txid, unspent_vout)
@assafshomer
assafshomer / txid.js
Created March 10, 2016 11:08
bitcoinjs-lib txid
var bitcoin = require('bitcoinjs-lib')
var keyPair = bitcoin.ECPair.makeRandom()
// Print your private key (in WIF format)
console.log(keyPair.toWIF())
// => Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct
// Print your public key address
console.log(keyPair.getAddress())
// => 14bZ7YWde4KdRb5YN7GYkToz3EHVCvRxkF
@assafshomer
assafshomer / sharetribe_on_heroku.md
Last active January 4, 2016 15:41
Sharetribe on Heroku

Deploying Sharetribe to Heroku

clone and push

  git clone repo <dirname>
  cd <dirname>
  git checkout <branch>
  heroku create
  git push heroku <branch>:master

Env vars

@assafshomer
assafshomer / gist:185f6a76de30ecad4231
Last active January 4, 2016 10:03
Upgrading Google Chrome in Linux

Add source

  sudo nano /etc/apt/sources.list

add the line

  deb http://dl.google.com/linux/deb/ stable main

Download key

@assafshomer
assafshomer / gist:1c214aa9d1a74133bec3
Last active December 7, 2015 11:04
Colored coins asset verifications
Verifying issuance of colored coins asset with ID #U3uPyQeyNRafPy7popDfhZui8Hsw98B5XMUpP
Verifying issuance of colored coins asset with ID #LKUYHRCMbqUNgfNCGFnXv1AvB5Pv8Lkk2EjoF
Verifying issuance of colored coins asset with ID #U9a36XP1UwL5pxaYYiZYJ86sUqWAJ2dGbLaer
Verifying issuance of colored coins asset with ID #LE2v9RbnNr6EJFArY5HZYEeWZgQppxaEEu7XL
Verifying issuance of colored coins asset with ID #LH4noQ7f8dF2Q2jySihJTjK9NpoEKJ8sY575A
Verifying issuance of colored coins asset with ID #LHEQJbm21GGzpHzwwuoraZUQ8LuApHXRqCrwk
@assafshomer
assafshomer / gist:aef0d0364ead3dc9b186
Created October 13, 2015 13:08
Colored Coins Asset Verification
Verifying issuance of colored coins asset with asset_id: [LGbocSa7jQ6egewe3bmEkqjFUEDvY6c4xetMR]
@assafshomer
assafshomer / gist:6c704f5759927212e714
Created October 8, 2015 10:07
colored coins asset verification
Verifying issuance of colored coins asset with asset_id: [LJEC6Q2h9JKNvZqEC87TbEXvxm4br1uivb2QX]
# Make sure to first bundle install gem 'terminal-table'
require 'terminal-table'
MAX_EXP = 16
def max_num(mantis_bits,available_bits)
mantis(mantis_bits)*(10**exponent(mantis_bits,available_bits))
end
require 'terminal-table'
def max_num(mantis_bits,available_bits)
mantis(mantis_bits)*(10**exponent(mantis_bits,available_bits))
end
def mantis(mantis_bits)
2**mantis_bits
end