Skip to content

Instantly share code, notes, and snippets.

View flashgrimmie's full-sized avatar

flashgrimmie

View GitHub Profile
@flashgrimmie
flashgrimmie / transaction.js
Created October 18, 2021 20:48
Send transaction with web3 in nodejs
const Web3 = require('web3');
const Provider = require('@truffle/hdwallet-provider');
const MyContract = require('./build/contracts/MyContract.json');
const address = '';
const privateKey = '';
const infuraUrl = '';
// Very hard way (web3#signTransaction() + web3#sendSignedTransaction())
const init1 = async () => {
const web3 = new Web3(infuraUrl);
@flashgrimmie
flashgrimmie / docker-mongo-repair
Created August 9, 2021 19:37
Run "mongo --repair" in Docker container that cannot start because of MongoDB error
#!/bin/bash
# See https://github.com/docker-library/mongo/pull/63
docker run --rm --volumes-from my-mongo-server mongo unlink "/data/db/mongod.lock"
docker run --rm --volumes-from my-mongo-server mongo --repair