Skip to content

Instantly share code, notes, and snippets.

View obernardovieira's full-sized avatar
🥸
do you even blockchain?

Bernardo obernardovieira

🥸
do you even blockchain?
View GitHub Profile
@obernardovieira
obernardovieira / sh
Created May 29, 2018 22:46
start_ethereum_private_nw_node
$ mkdir -p some_dir/node1
$ cd some_dir/node1
$ geth - identity "my_private_net" - nodiscover - networkid 15 - datadir . init genesis.json
$ geth account new - datadir .
$ geth - mine - etherbase "result_hash_from_previous_command" -rpccorsdomain "*" - ipcpath ./geth.ipc - rpc - networkid 15 - datadir . -maxpeers 5 - minerthreads 1
# (new shell in the same directory)
$ geth - ipcpath ./geth.ipc - datadir . attach
@obernardovieira
obernardovieira / sh
Created May 29, 2018 22:48
start_ethereum_private_nw_node_nodefault
$ mkdir -p some_dir/node1
$ cd some_dir/node1
$ geth - identity "my_private_net" - nodiscover - networkid 15 - datadir . init genesis.json
$ geth account new - datadir .
$ geth - mine - etherbase "result_hash_from_previous_command" -rpccorsdomain "*" - ipcpath ./geth.ipc - rpc - networkid 15 - datadir . -maxpeers 5 - minerthreads 1 - port 30304 - rpcport 7545
# (new shell in the same directory)
$ geth - ipcpath ./geth.ipc - datadir . attach

Keybase proof

I hereby claim:

  • I am obernardovieira on github.
  • I am obernardovieira (https://keybase.io/obernardovieira) on keybase.
  • I have a public key ASD5ogeLJ_QgYIR4lWIam_zmeVbIjTXcZF5tUPOLx7wkYgo

To claim this, I am signing this object:

@obernardovieira
obernardovieira / nginxproxy.md
Created March 18, 2019 16:07 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@obernardovieira
obernardovieira / walksync.js
Created March 25, 2019 23:01 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@obernardovieira
obernardovieira / .d3v4-selectable-force-directed-graph
Created May 2, 2019 14:47 — forked from pkerpedjiev/.d3v4-selectable-force-directed-graph
D3v4 Selectable, Draggable, Zoomable Force Directed Graph
.
did:muport:QmdE65oF2PsfbwZp4Ryw6KxEU7sMDGifbzygXxwHnRzevu
@obernardovieira
obernardovieira / web3j-article-basic.java
Last active May 22, 2019 20:56
basic example for web3j article
public class App
{
   // change contract-address
   private static String contractAddress = contract-address;
   // main method
   public static void main(String[] args) {
       // instantiate web3j
       Web3j web3 = Web3j.build(new
          HttpService("http://localhost:9545/"));
       Credentials credentials = Credentials.create(wallet-address);
Credentials credentials;
try {
  List<String> lines = Files.readAllLines(walletPathFile);
  credentials = WalletUtils.loadCredentials(walletPassword, new File(lines.get(0)));
} catch (IOException e) {
  String walletFile = WalletUtils.generateLightNewWalletFile(
          walletPassword, new File(WalletUtils.getDefaultKeyDirectory())
 );
  String walletFilePath = WalletUtils.getDefaultKeyDirectory() + "/" + walletFile;
  credentials = WalletUtils.loadCredentials(walletPassword, walletFilePath);
const express = require('express')
const bodyParser = require('body-parser')
const ngrok = require('ngrok')
const decodeJWT = require('did-jwt').decodeJWT
const { Credentials } = require('uport-credentials')
const transports = require('uport-transports').transport
const message = require('uport-transports').message.util
let endpoint = ''
const app = express();