Skip to content

Instantly share code, notes, and snippets.

View mariodian's full-sized avatar

Mario Dian mariodian

View GitHub Profile
@mariodian
mariodian / obsetup.sh
Created May 8, 2016 09:44
OpenBazaar Server installation script for Ubuntu
#!/bin/bash
# Run: "chmod u+x obsetup.sh" before running the script
user=$(whoami)
dir=$(pwd)
if [ $user = 'root' ]; then
echo "Please run this script as a regular user."
exit;
fi
@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
@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('');
Verifying my Blockstack ID is secured with the address 143u5qs8w6FM13Av93ZGpzcUKWsfDah1sX https://explorer.blockstack.org/address/143u5qs8w6FM13Av93ZGpzcUKWsfDah1sX
@mariodian
mariodian / openbazaar.service
Created August 31, 2016 17:10
Debian Systemd OpenBazaar Service
# Save as /lib/systemd/system/openbazaar.service
[Unit]
Description=OpenBazaar server
After=network.target auditd.service
[Service]
Type=forking
User=pi
Group=pi
PIDFile=/tmp/openbazaard.pid
@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 / grin.service
Created January 16, 2019 15:07
Grin systemd service
[Unit]
Description=Grin node
After=network.target
[Service]
WorkingDirectory=/home/satoshi/.grin/
User=satoshi
Group=satoshi
PrivateDevices=yes
@mariodian
mariodian / lnd_connect.sh
Last active January 23, 2019 05:25
Connect to peers that you have open channels with.
#!/bin/bash
jq --help >/dev/null 2>&1 || { echo >&2 "Error: 'jq' is required but not installed."; exit 1; }
LIST=$(lncli listchannels | jq -r '.[]')
LENGTH=$(echo $LIST | jq 'length')
for (( i=0; i<$LENGTH; i++ ));
do
NODE_PUBKEY=$(echo $LIST | jq ".[$i].remote_pubkey" | tr -d '"')
[Unit]
Description=ZTE SMS Forwarder timer
[Timer]
OnBootSec=10
OnUnitActiveSec=10
Unit=zte-sms-forwarder.service
[Install]
WantedBy=timers.target