Skip to content

Instantly share code, notes, and snippets.

@nhapentor
nhapentor / terraform_private_ethereum.tf
Last active September 15, 2021 01:49
Using a Terraform Module to Setup a Private Ethereum Network on AWS
/*
This is a usage example of the "SCB-TechX-Saber-Labs/ecs-private-ethereum-blockchain/aws" module version "0.1.0".
The arguments and outputs might be different in the future versions.
*/
# Call the module and set the local name as "private_ethereum" to refer to this instance of the module later.
module "private_ethereum" {
# Required argument
# To tell terraform where to download the module's source code when running "terraform init".
@nhapentor
nhapentor / $Running a Private Ethereum Blockchain using Docker.markdown
Last active May 24, 2024 18:25
Setup and run a cluster of nodes to build a private Ethereum network in Docker environment

Running a Private Ethereum Blockchain using Docker

Put genesis.json, Dockerfile, docker-compose.yml and .env files together in the same folder. Then run the command.

docker-compose up
@nhapentor
nhapentor / Convert Date Format with MongoDB Aggregation.markdown
Last active April 13, 2021 09:54
Aggregation pipeline to convert ISODate to desired string format in MongoDB prior to v3.0

Convert Date Format with MongoDB Aggregation

The following aggregation pipeline is used to convert ISODate to desired string format before MongoDB started providing $dateToStringoperator in v3.0

{
  $project: {
    day: { $dayOfMonth: "$LastUpdate" },
    month: { $month: "$LastUpdate" },
    year: { $year: "$LastUpdate" },

Modal Spinner

An extended jQuery function for spin.js to easily display modal spinner just by calling:

$.spin('true'); // To display the modal spinner

$.spin('false'); // To hide the modal spinner

This script requires jQuery and spin.js.