Skip to content

Instantly share code, notes, and snippets.

View mariodian's full-sized avatar

Mario Dian mariodian

View GitHub Profile
[Unit]
Description=NoIP update client
After=network.target
[Service]
Type=forking
User=pi
Group=pi
ExecStart=/usr/local/bin/noip2
#!/bin/sh
# Create log file
LOG="/tmp/ip-check.log"
touch $LOG
IP="$(dig +short myip.opendns.com @resolver1.opendns.com)"
LAST_IP="$(cat $LOG)"
if [ "$IP" != "$LAST_IP" ]; then
@mariodian
mariodian / HD.php
Last active June 25, 2023 17:56
Derive wallet addresses from xpub, ypub and zpub with Bit-Wasp/Bitcoin-php
<?php
require_once('vendor/autoload.php');
use BitWasp\Bitcoin\Bitcoin;
use BitWasp\Bitcoin\Address\AddressCreator;
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\GlobalPrefixConfig;
use BitWasp\Bitcoin\Key\Deterministic\HdPrefix\NetworkConfig;
use BitWasp\Bitcoin\Network\Slip132\BitcoinRegistry;
use BitWasp\Bitcoin\Key\Deterministic\Slip132\Slip132;
@mariodian
mariodian / gist:3fcf8e3992c2c48c4e26b67ffe5f22d3
Last active November 6, 2018 16:50
ElectrumX ENV Variables
DAEMON_URL = http://<bitcoin.conf rpcuser>:<bitcoin.conf rpcpassowrd>@localhost:8332/
DB_DIRECTORY = /Users/bitcoin/.electrumx/
DB_ENGINE = leveldb
USERNAME = bitcoin
ELECTRUMX = /Users/bitcoin/source/electrumx/electrumx_server
HOST = 0.0.0.0
ANON_LOGS = fuck off :)
BANNER_FILE = /Users/bitcoin/.electrumx/banner.txt
DONATION_ADDRESS = 34ie35p4G1npt6GoXR9BDhmMndNwCsiiEr
@mariodian
mariodian / electrumx.conf
Created May 16, 2017 02:05
ElectrumX config for Linux
DAEMON_URL = http://<bitcoin.conf rpcuser>:<bitcoin.conf rpcpassowrd>@localhost:8332/
DB_DIRECTORY = /home/bitcoin/.electrumx/
DB_ENGINE = leveldb
USERNAME = bitcoin
ELECTRUMX = /home/bitcoin/source/electrumx/electrumx_server.py
HOST = 0.0.0.0
ANON_LOGS = "fuck off :)"
BANNER_FILE = /home/bitcoin/.electrumx/banner.txt
DONATION_ADDRESS = 1x1UnfVJu7cprs3E2jjQ9WRcdDi5KJxAU
@mariodian
mariodian / ob2start.sh
Created June 23, 2017 10:44
OpenBazaar 2.0 startup hack
#!/bin/bash
# Run via cron
# */5 * * * * sh /home/pi/bin/ob2start.sh >/dev/null 2>&1
PID="$(ps aux | grep -i openbazaard.go | grep -v grep | awk {'print $2'})"
if [ -z "$PID" ]; then
go run $GOPATH/src/github.com/OpenBazaar/openbazaar-go/openbazaard.go start
fi
Verifying my Blockstack ID is secured with the address 143u5qs8w6FM13Av93ZGpzcUKWsfDah1sX https://explorer.blockstack.org/address/143u5qs8w6FM13Av93ZGpzcUKWsfDah1sX
@mariodian
mariodian / create-unattended-iso.sh
Created July 4, 2017 10:44
Create unattended iso.sh
#!/usr/bin/env bash
# file names & paths
tmp="/tmp" # destination folder to store the final iso file
hostname="ubuntu"
currentuser="$( whoami)"
# define spinner function for slow tasks
# courtesy of http://fitnr.com/showing-a-bash-spinner.html
spinner()
@mariodian
mariodian / gist:236a831c4e0dd4772ca866eb81f9cac5
Created November 1, 2017 06:55
Add nLocktime to a raw Bitcoin transcation
String.prototype.lpad = function(padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
}
var blockHeight = 434695,
rawTx = '<raw transaction>',
blockLittleEndian = (blockHeight).toString(16).lpad('0', 8).match(/../g).reverse().join('');
@mariodian
mariodian / lnd.service
Created March 22, 2018 10:10
LND Systemd script
[Unit]
Description=LND Lightning Daemon
Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/home/satoshi/go/bin/lnd
ExecStop=/home/satoshi/go/bin/lncli stop
PIDFile=/home/satoshi/.lnd/lnd.pid