Skip to content

Instantly share code, notes, and snippets.

View gabmontes's full-sized avatar

Gabriel Montes gabmontes

View GitHub Profile
@gabmontes
gabmontes / list-extensions
Created October 18, 2024 19:36
List the extensions of all files tracked in the repository
#!/bin/bash
git ls-tree -r master --name-only | awk -F. '!/^\./ && NF>1 {print $NF}' | sort | uniq
@gabmontes
gabmontes / test-node-version
Created October 10, 2024 14:11
Simple Bash script to test a package with all Node.js versions
#!/bin/bash
set -e
# shellcheck disable=SC1091
. "$NVM_DIR/nvm.sh"
test_node_version() {
VERSION=$1
echo "Testing Node $VERSION -------------------------------------------------"
@gabmontes
gabmontes / klotski.js
Created August 8, 2021 21:51
A small program to solve the Klotski puzzle, also know as "Trabado"
"use strict";
const initialState = [
"21v",
"4",
"4",
"22v",
"21v",
"4",
"4",
@gabmontes
gabmontes / new-mac-install.sh
Created April 21, 2021 13:28
Install many apps in a new Mac using a single script
#!/bin/sh
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
# Install all
brew cask install \
brave-browser \
docker \
gpg-suite-no-mail \
@gabmontes
gabmontes / last-eth-block-time.sh
Last active September 11, 2020 20:54
Get the time of the latest Ethereum block in one line
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":"0"}' -s http://localhost:8545| jq '.result.timestamp' | xargs -I {} node -e "console.log(new Date(Number.parseInt('{}'.substr(2),16) * 1000))"
@gabmontes
gabmontes / bloq.js
Created July 6, 2020 23:46
Sweep BCH paper wallets with easy
'use strict'
require('dotenv').config()
const { connect } = require('@bloq/cloud-sdk')
// Create a Bloq Connect client
const bloq = (coin = 'btc', network = 'mainnet') => connect.http({
coin,
network,
auth: {
  • 001 F-WTSS - Museum of Air and Space, Le Bourget, France
  • 002 G-BSST - Fleet Air Arm Museum, Yeovilton, England, UK
  • 101 G-AXDN - Imperial War Museum, Duxford, England, UK
  • 102 F-WTSA - Musée Delta, Orly Airport, Paris, France
  • 201 F-WTSB - Airbus Factory, Toulouse, France
  • 202 G-BBDG - Brooklands Museum, Weybridge, Surrey, England, UK
  • 203 F-BTSC - Destroyed in air crash outside Paris, France
  • 204 G-BOAC - Manchester Airport, England, UK
  • 205 F-BVFA - Smithsonian National Air and Space Museum, Chantilly, Virginia USA
  • 206 G-BOAA - Museum of Flight, East Lothian, Scotland, UK
  • Challenger OV-099
  • Enterprise OV-101 Intrepid Sea-Air-Space Museum, New York City, New York
  • Columbia OV-102
  • Discovery OV-103 Udvar-Hazy Center, Smithsonian Institution's National Air and Space Museum, Chantilly, Virginia
  • Atlantis OV-104 Kennedy Space Center, Merritt Island, Florida
  • Endeavour OV-105 California Science Center, Los Angeles, California.

Ref: https://en.wikipedia.org/wiki/Space_Shuttle_retirement

Alabama:

  • A-12 #06930 - On display at the U.S. Space & Rocket Center, Huntsville, AL.
  • A-12 #06937 - On display at the Southern Museum of Flight, Birmingham, AL.
  • A-12 #06938 - On display at the USS Alabama Battleship Memorial Park, Mobile, AL.

Arizona:

  • SR-71A #17951 - On display at the Pima Air Museum, Tucson, AZ.

California:

  • A-12 #06924 - On display at the Blackbird Airpark in Palmdale, CA.
@gabmontes
gabmontes / mnemonic-balance.js
Created February 17, 2019 23:03
Walk through all addresses derived from a mnemonic and sum up balances
const got = require('got')
const Mnemonic = require('bitcore-mnemonic')
const mnemonic = '? ? ? ? ? ? ? ? ? ? ? ?' // 12-word mnemonic
const words = Mnemonic.Words.ENGLISH // or SPANISH, etc
const derivationPath = "m/44'/0'/0'" // BIP-44
const insightApiUrl = 'https://insight.bitpay.com/api'
const toBtc = sat => sat / 100000000