Skip to content

Instantly share code, notes, and snippets.

const Web3 = require('web3');
class TransactionChecker {
web3;
web3ws;
account;
subscription;
constructor(projectId, account) {
this.web3ws = new Web3(new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws/v3/' + projectId));
@akaron
akaron / geth_rpc_server.md
Last active August 9, 2022 14:16
create private geth rpc server using ssh port forwarding

note: create private geth rpc server using ssh port forwarding

In short, user provide ssh key to rpc server manager. Once the manager configured, then everytime the user need to type folowing commands to access to the geth rpc server:

  1. ssh -N -L 9545:localhost:8545 geth@machine_A_addr
  2. ... and set the rpc to http://localhost:9545

For convenienve, in the following I use these abbreviations:

  • machine A: run geth full node with RPC server
  • machine B: using the geth RPC from machine A
@kekru
kekru / 01nginx-tls-sni.md
Last active April 1, 2024 02:29
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@JBaczuk
JBaczuk / addrgen
Created December 15, 2018 20:00
addrgen
#!/bin/bash
echo
echo "Welcome to the Bitcoin address generator!"
echo "input private key (32 bytes, hex format)"
read priv
echo ""
echo "#####################################"
# priv=0C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D # Testing only
@sappelt
sappelt / bitcoin_connection.py
Created June 1, 2018 16:31
How to establish a connection to the bitcoin manually. Peer discovery + connecting and sending version message
# Import requests and regex library
import requests
import re
def get_external_ip():
# Make a request to checkip.dyndns.org as proposed
# in https://en.bitcoin.it/wiki/Satoshi_Client_Node_Discovery#DNS_Addresses
response = requests.get('http://checkip.dyndns.org').text
# Filter the response with a regex for an IPv4 address
@katopz
katopz / setup-zeromq.sh
Last active August 10, 2021 21:47 — forked from cdjhlee/zeromq_install.sh
Setup zeromq in Ubuntu 16.04
#!/usr/bin/bash
# Download zeromq
# Ref http://zeromq.org/intro:get-the-software
wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz
# Unpack tarball package
tar xvzf zeromq-4.2.2.tar.gz
# Install dependency
@spynappels
spynappels / inky_btc_wallet.py
Created July 3, 2017 07:28
A Python3 script to fetch and display the balance and value of a specified BTC wallet, as well as current USD price and percentage change since a specified date, defaulting to last entry in blockchain.info Market Price chart. Display used is Pimoroni inky pHAT.
#!/usr/bin/env python3
# Stefan Pynappels, 2017
# v0.1
# Due to the slow refresh rate of the Pimoroni inky pHAT, this is best called at
# intervals from cron. I use a 15min interval on my test system.
# Import pre-requisite modules
import json
@giocomai
giocomai / SaveWebpage.js
Created May 1, 2015 15:00
Download a webpage with phantomjs from the command line. This allows to wait for javascript to be processed before saving the page, which cannot be achieved with wget. Download SaveWebpage.js, and then, from the terminal, run: phantomjs SaveWebpage.js URL nameOfSavedFile
var system = require('system');
var page = require('webpage').create();
var url = system.args[1];
var destination = system.args[2];
page.settings.resourceTimeout = 10000;
setTimeout(function(){
setInterval(function () {