I hereby claim:
- I am jdkanani on github.
- I am jdkanani (https://keybase.io/jdkanani) on keybase.
- I have a public key whose fingerprint is 8A3D 2354 49B2 0A6A 94FE EA38 4396 982C 976B AE5E
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(set up two connected nodes and mine 1 block)
npm install
HTTP_PORT=3001 P2P_PORT=6001 npm start
HTTP_PORT=3002 P2P_PORT=6002 PEERS=ws://localhost:6001 npm start
curl -H "Content-type:application/json" --data '{"data" : "Some data to the first block"}' http://localhost:3001/mineBlock
export function fetchBlock (web3, blockNumber) { | |
return web3.eth.getBlock(blockNumber); | |
} | |
export function fetchTransactions (web3, txs) { | |
return new Promise((resolve, reject)=>{ | |
let result = []; | |
let _resolved = false; | |
let callback = (err, obj) => { |
export function sleepFor (timeInMilliSeconds = 1000) { | |
return new Promise((resolve, reject)=>{ | |
setTimeout(resolve, timeInMilliSeconds); | |
}); | |
} | |
export function waitFor (...names) { | |
return (target, prop, descriptor) => { | |
const fn = descriptor.value; | |
let newFn = function (...args) { |
import Vue from 'vue'; | |
import { VueFireMixin, firebaseMutations, bind, unbind } from '~/plugins/vuefire'; | |
// vuefire init | |
export default function ({ store }) { | |
// use object-based merge strategy | |
// TODO This makes impossible to merge functions | |
const mergeStrats = Vue.config.optionMergeStrategies; | |
mergeStrats.firebase = mergeStrats.methods; |
sudo fallocate -l 1G /swapfile | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile | |
sudo swapon --show | |
sudo cp /etc/fstab /etc/fstab.bak | |
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab | |
sudo sysctl vm.swappiness=10 | |
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf | |
sudo sysctl vm.vfs_cache_pressure=50 |
Verifying my Blockstack ID is secured with the address 1BmZj9kZEstcPsVLbLmR1vYLe8QhunpApG https://explorer.blockstack.org/address/1BmZj9kZEstcPsVLbLmR1vYLe8QhunpApG |
// web3 contract | |
var web3Contract = new web3.eth.Contract(abi, address); | |
// dagger contract | |
var contract = dagger.contract(web3Contract); | |
var filter = contract.events.Transfer({filter: {from: '0x123456...'}, room: 'latest'}); | |
// watch | |
filter.watch(function(data, removed){ | |
// data.returnValues.to : address to which it has been transferred to | |
// data.returnValues.value : value which has been transferred |
import Web3 from 'web3' | |
function getCallback(payload, cb) { | |
return function(err, result) { | |
const obj = {} | |
const keys = ['id', 'jsonrpc'] | |
keys.forEach(key => { | |
obj[key] = payload[key] | |
}) | |
obj.result = result |
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/