This file contains hidden or 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 level = require('level'); | |
const levelup = require('levelup'); | |
const RLP = require('rlp'); | |
const Trie = require('merkle-patricia-tree') | |
const DATADIR_PATH = '../../simple_geth_launcher/data_node1'; | |
/* | |
const nodeDb = level('/home/da/.ethereum/geth/nodes'); | |
const nodeDataArr = []; |
This file contains hidden or 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 printMatrix = (matrix) => matrix.forEach((line,j) => console.log('('+j+')',line)); | |
// USES ALGORITHM THAT I DESCRIBED WHICH WAS WRONG!!!! | |
const countIslandsMyAlgorithm = (matrix) => { | |
const checkCounterMatrix = (counterMatrix,i,j) => { | |
if((i-1 >= 0) && (counterMatrix[i-1][j] !== 0)) return counterMatrix[i-1][j]; | |
if((j-1 >= 0) && (counterMatrix[i][j-1] !== 0)) return counterMatrix[i][j-1]; | |
// this 2 cases are never considered in any of the matrices, this causes issues | |
if((i+1 < matrix.length) && (matrix[i+1][j] !== 0)) return counterMatrix[i+1][j] = 0; |
This file contains hidden or 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 | |
UP_SYMBOL=▲ | |
DOWN_SYMBOL=▼ | |
# BTC_SYMBOL="<fc=#FFFF00>฿</fc>" | |
BTC_SYMBOL="<fc=#FF9900><fn=1></fn></fc>" | |
#ETH_SYMBOL="<fc=#7777FF>Ξ</fc>" | |
ETH_SYMBOL="<fc=#7777FF><fn=1></fn></fc>" | |
This file contains hidden or 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
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/ethclient" | |
"github.com/ethereum/go-ethereum/ethdb" |
This file contains hidden or 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
package main | |
import ( | |
"fmt" | |
"log" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/ethdb/memorydb" | |
"github.com/ethereum/go-ethereum/rlp" | |
"github.com/ethereum/go-ethereum/trie" |
This file contains hidden or 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
package ionflow | |
import ( | |
"bytes" | |
"context" | |
"math/big" | |
"regexp" | |
"strings" | |
"testing" |
This file contains hidden or 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 level = require('level') | |
const rlp = require('rlp') | |
const chaindatadirectory = './data_node_0/geth/chaindata' | |
const TX_ROOT_HASH = '146d436eb3af4eeaf1f421d86a8994ef9f6e3670393837e9141f7f44b00e01cf' | |
const STATE_ROOT_HASH = '0c773fdbbe314cbeb0908d1b4949b39d1edca0653efee339882679538fce3318' | |
level(chaindatadirectory, { keyEncoding: 'utf8', valueEncoding: 'binary'}, async (err, db) => { | |
if(err) { | |
console.log('ERROR: ',err) |
This file contains hidden or 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 | |
#-x | |
NODE_NUMBER=$1 | |
REMAINING_ARGS=${@:2} | |
re_number=^-?[0-9]+$ | |
if ! [[ $NODE_NUMBER =~ $re_number ]]; then | |
echo "First argument needs to be a number!" | |
exit 1 |
This file contains hidden or 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
def mining(k, mines): | |
n = len(mines) | |
#create matrix | |
matrix = [] | |
for i in range(n): | |
row = [] | |
distance_i = mines[i][0] | |
weight_i = mines[i][1] | |
for j in range(n): | |
distance_j = mines[j][0] |
This file contains hidden or 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 | |
#Libs used for keccak-256sum | |
#https://github.com/maandree/libkeccak.git | |
#https://github.com/maandree/argparser.git | |
#https://github.com/maandree/sha3sum.git | |
# Generate the private and public keys | |
KEY="$(openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout 2> /dev/null)" | |
echo "$KEY" |