Skip to content

Instantly share code, notes, and snippets.

View C-Otto's full-sized avatar
🏠
Working from home

Carsten Otto C-Otto

🏠
Working from home
View GitHub Profile
@C-Otto
C-Otto / sh
Last active January 4, 2023 09:23
Amboss ping shell script
#!/bin/bash
URL="https://api.amboss.space/graphql"
NOW=$(date -u +%Y-%m-%dT%H:%M:%S%z)
SIGNATURE=$(lncli signmessage "$NOW" | jq -r .signature)
JSON="{\"query\": \"mutation HealthCheck(\$signature: String!, \$timestamp: String!) { healthCheck(signature: \$signature, timestamp: \$timestamp) }\", \"variables\": {\"signature\": \"$SIGNATURE\", \"timestamp\": \"$NOW\"}}"
echo "$JSON" | curl -s --data-binary @- -H "Content-Type: application/json" -X POST --output /dev/null $URL
#!/bin/bash
TMP_DIR=somewhere
PIC_DIR=somewhere_else
SHORT=h # iterate over h, d, y?
LONG="hour" # iterate over "hour", "day", "year"?
WIDTH=500
rrdtool graph $TMP_DIR/bitcoin_conn_$SHORT.png \
--end now --start end-1$SHORT \
-t "Bitcoin Connections last $LONG" \
#!/usr/bin/env python
import os
import sys
import time
import socket
import subprocess
import json
hostname = os.environ['COLLECTD_HOSTNAME'] if 'COLLECTD_HOSTNAME' in os.environ else socket.getfqdn()