Skip to content

Instantly share code, notes, and snippets.

View magicsih's full-sized avatar

Syous magicsih

View GitHub Profile
@magicsih
magicsih / README.txt
Last active January 3, 2022 12:47
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. [Super Urban Cat] Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=true&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@magicsih
magicsih / crawl-image.sh
Created March 17, 2022 04:08
Download some sequential named images from web in bash script.
#!/bin/bash
set -B
for i in {1..1000}; do
curl $path/$i.png > $i.png # replcae $path with yours
done
@magicsih
magicsih / random_mnemonic.js
Last active July 24, 2022 15:19
Generate random mnemonic.
const ethers = require('ethers');
const mnemonic = await ethers.utils.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
@magicsih
magicsih / bulkInsertFromFile.js
Created March 24, 2023 05:10
This Node.js script reads data from a file and inserts it into a MySQL database using bulk insert. It initializes a read stream from the file and an empty array to store the data. As the stream reads data, it converts each line from a hexadecimal string to a Buffer object and adds it to the data array. Once the data array reaches a certain size …
const fs = require('fs');
const mysql = require('mysql');
// MySQL database connection configuration
const connection = mysql.createConnection({
host: '<host>',
user: '<user>',
password: '<password>',
database: '<database>'
});