Skip to content

Instantly share code, notes, and snippets.

@mariodian
mariodian / lnd.sh
Created March 22, 2018 10:16
LND start/stop script (lnd.service needed)
#!/bin/bash
if [ "$1" = "start" ]; then
echo "Starting Lightning Network"
echo "====================="
sudo service lnd start &
lncli unlock
elif [ "$1" = "stop" ]; then
echo "Stopping Lightning Network"
@mariodian
mariodian / monerod.service
Last active October 12, 2022 11:13
Monero Full Node systemd script
[Unit]
Description=Monero Full Node
After=network.target
[Service]
User=satoshi
Group=satoshi
Type=forking
PIDFile=/home/satoshi/.bitmonero/monerod.pid
@mariodian
mariodian / install-lnd.sh
Last active February 19, 2022 04:21
Install LND
#!/bin/sh
# Get number of cores to speed up the compilation time
CORES=$(( $(lscpu | awk '/^Socket/{ print $2 }') * $(lscpu | awk '/^Core/{ print $4 }') ))
# Other vars
IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
BTC_CONF=~/.bitcoin/bitcoin.conf
LND_DIR=~/.lnd
LND_CONF=lnd.conf
@mariodian
mariodian / nbxplorer.service
Created November 8, 2018 05:17
NBXplorer Systemd Service
[Unit]
Description=NBXplorer daemon
Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/usr/bin/dotnet "/home/satoshi/source/NBXplorer/NBXplorer/bin/Release/netcoreapp2.1/NBXplorer.dll" -c /home/satoshi/.nbxplorer/Main/settings.config
User=satoshi
Group=satoshi
Type=simple
@mariodian
mariodian / btcpayserver.service
Last active October 12, 2022 11:27
BTCPayServer Systemd Service
[Unit]
Description=BtcPayServer daemon
Requires=btcpayserver.service
After=nbxplorer.service
[Service]
ExecStart=/usr/bin/dotnet run --no-launch-profile --no-build -c Release -p "/home/satoshi/source/btcpayserver/BTCPayServer/BTCPayServer.csproj" -- $@
User=satoshi
Group=satoshi
Type=simple
@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 '"')
@mariodian
mariodian / service_status.sh
Last active November 14, 2021 01:43
Check status of systemd services
#!/bin/bash
URL="https://freedomnode.com/server-maintenance"
if [ "`wget -qO- $URL | sed -e 's/<[^>]*>//g' 2> /dev/null`" != "true" ]; then
SERVICES=(bitcoind lnd monerod btcpayserver nbxplorer thunderhub electrs tor nginx)
TITLE="Services alert!"
MESSAGE=""
for SERVICE in "${SERVICES[@]}"
@mariodian
mariodian / zte-sms-forwarder.sh
Last active August 16, 2024 11:32
ZTE 3G/4G Modem SMS Forwarder
#!/bin/bash
PUSHOVER_TOKEN="<token>"
PUSHOVER_USER="<user>"
# The list of blocked keywords
declare -a BLOCKED=("uber eats" "block another keyword")
URL=http://192.168.0.1
REFERER="$URL/index.html"
URL_SET="$URL/goform/goform_set_cmd_process"
[Unit]
Description=ZTE SMS Forwarder timer
[Timer]
OnBootSec=10
OnUnitActiveSec=10
Unit=zte-sms-forwarder.service
[Install]
WantedBy=timers.target