Skip to content

Instantly share code, notes, and snippets.

View hadv's full-sized avatar
🎯
Focusing

Ha DANG hadv

🎯
Focusing
  • ÐΞV
  • Hanoi
View GitHub Profile
pragma solidity ^0.8.3;
contract Proxy {
address immutable public implementation;
event Received(uint indexed value, address indexed sender, bytes data);
constructor(address _implementation) {
implementation = _implementation;
pragma solidity ^8.0.0;
contract Machine {
address immutable public s;
constructor(address addr) public {
s = addr;
calculateResult = 0;
}
pragma solidity ^0.5.8;
interface StorageInterface {
function saveValue(uint x) public returns (bool);
}
contract Machine {
StorageInterface public s;
constructor(StorageInterface addr) public {
pragma solidity ^0.5.8;
import "./Storage.sol";
contract Machine {
Storage public s;
constructor(Storage addr) public {
s = addr;
calculateResult = 0;
pragma solidity ^0.5.8;
contract Storage {
uint public val;
constructor(uint v) public {
val = v;
}
function setValue(uint v) public {
@hadv
hadv / nginx.conf
Created October 17, 2019 08:24 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:

Keybase proof

I hereby claim:

  • I am hadv on github.
  • I am dvietha (https://keybase.io/dvietha) on keybase.
  • I have a public key ASAm1r0IYGKtBL7GQIkzqcAxxskaUhX4l4VH-wP7wFuGego

To claim this, I am signing this object:

@hadv
hadv / sendSignedTransaction.js
Last active July 22, 2019 07:35
sendSignedTransaction
web3.eth.sendSignedTransaction(raw)
.on('transactionHash', (hash) => {
console.log('sent tx with hash: ' + hash);
})
.on('error', (err) => {
console.log('error: ' + err);
});
@hadv
hadv / installing-get-on-centos.md
Created June 21, 2019 13:48 — forked from bradlucas/installing-get-on-centos.md
Installing Geth on Centos
$ sudo yum -y update
$ sudo yum -y install golang
$ sudo yum -y install gmp-devel
$ sudo yum -y install git
$ git clone https://github.com/ethereum/go-ethereum
$ cd go-ethereum/
$ make geth
$ ls -al build/bin/geth
@hadv
hadv / main.go
Created April 25, 2019 08:42 — forked from wayneashleyberry/main.go
Go http server with graceful shutdown
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"syscall"
)