Skip to content

Instantly share code, notes, and snippets.

View torfbolt's full-sized avatar

David Kiliani torfbolt

View GitHub Profile
@torfbolt
torfbolt / low-battery-level-detection-notification-for-all-battery-sensors.yaml
Last active October 15, 2022 23:06 — forked from dadge/low-battery-level-detection-notification-for-all-battery-sensors.yaml
Home Assistant Blueprint: Low battery level detection & notification for all battery sensors
blueprint:
name: Batteries Warning
description: Regularly test all sensors with 'battery' device-class for crossing
a certain battery level threshold or unseen sensor and if so execute an action.
domain: automation
input:
threshold:
name: Battery warning level threshold
description: Battery sensors below threshold are assumed to be low-battery (as
well as binary battery sensors with value 'on').
@torfbolt
torfbolt / rocketpool-deposit-loop
Created December 7, 2021 17:04
Script to wait for the right time to make a rocketpool deposit
#!/bin/bash
# usage example: ./rocketpool-deposit-loop 20 100 && rocketpool -f 120 -i 10 n d -a 16 -s 5 -l 0xSEED -y
gasprice () {
echo $(($(curl -X post http://ethnode:8545 -H "content-type: application/json" --data "{\"method\":\"eth_gasPrice\",\"params\":[],\"id\":1}" -s | sed -nr "s/.*(0x[0-9a-f]*).*/\1/p"))) / 1000000000 | bc
}
commission () {
rocketpool e f | grep current | sed -n 's/.* \([0-9.]*\).*/\1/p'
}
@torfbolt
torfbolt / create-exit-transaction.sh
Last active March 14, 2023 09:10
Script to generate a voluntary exit transaction for an eth2 validator key generated with launchpad
#!/bin/bash
# Usage: ./create-exit-transaction.sh /path/to/validator/keystore.json
BASEDIR=/tmp/ethdo-tmp
WN=import-wallet
ETHDO="ethdo"
# this doesn't work well so far
# docker pull wealdtech/ethdo
# ETHDO="docker run --network=host -v /tmp:/tmp -it wealdtech/ethdo"
@torfbolt
torfbolt / lh-vc-config-from-wallet.sh
Created May 29, 2020 09:28
Script to generate lighthouse validator config files from EIP-2386 wallets
#!/bin/bash
# usage: ./lh-vc-config-from-wallet.sh wallet/account-regex keystore-passphrase
# example: ./lh-vc-config-from-wallet.sh "witti-validator/lighthouse.*" "witti"
WALLET_DIR="$HOME/.config/ethereum2/wallets"
LH_DIR="$HOME/.lighthouse"
for w in $WALLET_DIR/*; do
wn=$(cat "$w/${w##*/}" | jq -r '.name')
# echo $wn