Skip to content

Instantly share code, notes, and snippets.

View michelem09's full-sized avatar

Michele Marcucci michelem09

View GitHub Profile
#!/bin/bash
# Collects system performance statistics such as CPU, memory, and disk
# usage as well as top processes ran by users.
#
# All size values are in KiB (memory, disk, etc).
# EXAMPLE USAGE:
# ./os_stats.sh
Verifying my Blockstack ID is secured with the address 1J1gvTgkc9aiouzy375RN67CfU2MvxJ4uJ https://explorer.blockstack.org/address/1J1gvTgkc9aiouzy375RN67CfU2MvxJ4uJ
@michelem09
michelem09 / generate-eth-wallet-keypair.js
Created July 24, 2018 15:21
Programmatically generate keypair for Ethereum wallet: private key, public key and address
var keythereum = require('keythereum');
var Wallet = require('ethereumjs-wallet');
// Generate private key
var dk = keythereum.create();
var keyObject = keythereum.dump('password', dk.privateKey, dk.salt, dk.iv);
var privateKeyString = dk.privateKey.toString('hex');
console.log('Private key', privateKeyString);
// Get public key
@michelem09
michelem09 / get_eth_nodes.sh
Last active June 3, 2020 05:46
Simple bash script to get list of latest 50 active nodes for Ethereum blockchain (ETH mainnet) from https://www.ethernodes.org/network/1/nodes. Useful to have the list ready for Parity bootnodes config option.
#!/bin/bash
### Usage ###
# ./get_eth_nodes.sh <json | strings>
# Use json to get an array of nodes in JSON suitable for Parity
# Use strings to get a list of nodes line by line
#############
ARRAY=()
NODES=`curl -s 'https://www.ethernodes.org/network/1/data?draw=1&columns%5B0%5D%5Bdata%5D=id&columns%5B0%5D%5Bname%5D=&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=host&columns%5B1%5D%5Bname%5D=&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=port&columns%5B2%5D%5Bname%5D=&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=true&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B3%5D%5Bdata%5D=country&columns%5B3%5D%5Bname%5D=&columns%5B3%5D%5Bsearchable%5D=true&columns%5B3%5D%5Borderable%5D=tru
@michelem09
michelem09 / node-async-mongodb-multiple-updates.js
Last active August 8, 2022 07:49
Gist to update several items in series in a huge MongoDB collection (millions of records) with Node.js and Async module
'use strict';
/**
* Module dependencies.
*/
var async = require('async'),
mongoose = require('mongoose'),
ObjectId = mongoose.Types.ObjectId;
var db = mongoose.connect('mongodb://localhost:27017/test', {}, function (err) {
Verifying that +michelem is my Bitcoin username. You can send me #bitcoin here: https://onename.io/michelem
@michelem09
michelem09 / keybase.md
Last active November 24, 2015 13:56
keybase.md

Keybase proof

I hereby claim:

  • I am michelem09 on github.
  • I am michelem (https://keybase.io/michelem) on keybase.
  • I have a public key whose fingerprint is DADD 47B0 0DBD 873D 446C 3EB7 44FD 2A41 CA31 7D29

To claim this, I am signing this object: