From 34e2ca053ef5c523636edaa5ff137dfbf7a926d3 Mon Sep 17 00:00:00 2001 From: Martin Matous Date: Mon, 17 Mar 2025 17:36:35 +0100 Subject: [PATCH] prune scripts --- README.md | 21 ------------ from-ca-to-server.sh | 79 -------------------------------------------- gasquery.py | 36 -------------------- 3 files changed, 136 deletions(-) delete mode 100644 from-ca-to-server.sh delete mode 100755 gasquery.py diff --git a/README.md b/README.md index ee42e53..95d2a18 100644 --- a/README.md +++ b/README.md @@ -41,17 +41,6 @@ Dependencies: selenium, geckodriver, e-waste Usage: Run as a systemd service -## gasquery.py -Query Alchemy API for current ETH L1 basefee. -Intended for consumption by i3status-rs' custom block. - -Status: active use - -Dependencies: Alchemy API key - -Usage: `gasquery.py ` - - ## gentoo-chroot.sh Automate chrooting from live USB to fix installed system. @@ -98,16 +87,6 @@ Dependencies: ffmpeg Usage: `flac-convert.py /path/to/music` -## from-ca-to-server.sh -Create own CA and use it to sign a certificate - -Status: ancient one-off, unknown purpose - -Dependencies: openssl - -Usage: ??? - - ## jxl-convert.py Recursively convert jpgs to jxls with additional checks. diff --git a/from-ca-to-server.sh b/from-ca-to-server.sh deleted file mode 100644 index 7b611a2..0000000 --- a/from-ca-to-server.sh +++ /dev/null @@ -1,79 +0,0 @@ -# generate key -sudo openssl ecparam -out ca-key.pem -name secp384r1 -genkey -# generate certificate signing request -sudo openssl req -config dassem-ca.conf -new -key ca-key.pem -out ca-cert-req.pem -sha384 -extensions v3_ca -# sign request -sudo openssl x509 -in ca-cert-req.pem -out ca-cert.pem -req -signkey ca-key.pem -days 365 -extfile dassem-ca.conf -extensions v3_ca -# verify output -sudo openssl x509 -in ca-cert.pem -text -noout - -# generate key for server -sudo openssl ecparam -out glados-key.pem -name secp384r1 -genkey -# generate request -sudo openssl req -config dassem-ca.conf -new -key glados-key.pem -out glados-cert-req.pem -sha384 -extensions v3_req -# sign it with our CA -sudo openssl ca -in glados-cert-req.pem -out glados-cert.pem -config dassem-ca.conf -extensions v3_req -policy signing_policy - -#config file used: -HOME = . -RANDFILE = /root/.rnd - -#################################################################### -[ ca ] -default_ca = CA_default # The default ca section - -[ CA_default ] - -default_days = 1000 # how long to certify for -default_crl_days = 30 # how long before next CRL -default_md = sha384 # use public key default MD -preserve = no # keep passed DN ordering - -x509_extensions = v3_ca # The extensions to add to the cert - -email_in_dn = no # Don't concat the email in the DN -copy_extensions = copy # Required to copy SANs from CSR to cert - -#################################################################### -[ req ] -default_bits = 384 -default_keyfile = ca-key.pem -distinguished_name = ca_distinguished_name -x509_extensions = v3_ca -req_extensions = v3_req -string_mask = utf8only - -#################################################################### -[ ca_distinguished_name ] -countryName = Country Name (2 letter code) -countryName_default = ME - -stateOrProvinceName = State or Province Name (full name) -stateOrProvinceName_default = Malazan Empire - -localityName = Locality Name (eg, city) -localityName_default = Malaz City - -organizationName = Organization Name (eg, company) -organizationName_default = Malazan military forces - -organizationalUnitName = Organizational Unit (eg, division) -organizationalUnitName_default = "Dassem's First Sword" - -commonName = Common Name (e.g. server FQDN or YOUR name) -commonName_default = Dassem Ultor - -emailAddress = Email Address -emailAddress_default = dassem@dessembrae.com - -#################################################################### -[ v3_req ] -basicConstraints = CA:FALSE -keyUsage = digitalSignature, nonRepudiation, keyEncipherment - -[ v3_ca ] -subjectKeyIdentifier = hash -authorityKeyIdentifier = keyid:always, issuer -basicConstraints = critical, CA:TRUE, pathlen:0 -keyUsage = keyCertSign, cRLSign - diff --git a/gasquery.py b/gasquery.py deleted file mode 100755 index f655978..0000000 --- a/gasquery.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python - -import json -import requests -import subprocess -import sys - -API_KEY = sys.argv[1] -BASEFEE_THRESHOLD = int(sys.argv[2]) - -def to_gwei(wei: int) -> int: - return int(wei/(10**9)) - -response = requests.post( - url=f'https://eth-mainnet.alchemyapi.io/v2/{API_KEY}', - data='{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":0}' - ) -if not response.ok: - subprocess.run(['notify-send', 'Gasquery', f'Query returned {response.status_code}: {response.reason}']) - print('{"text": "⚠️NaN"}') - sys.exit() - -basefee = response.json()['result'] -basefee = to_gwei(int(basefee, base=16)) -if basefee <= BASEFEE_THRESHOLD: - subprocess.run(['notify-send', 'Gasquery', f'Current basefee is {basefee}']) - -state = 'Idle' -if basefee < BASEFEE_THRESHOLD: - state = 'Good' -elif basefee > 150: - state = 'Warning' -elif basefee > 200: - state = 'Critical' -text = '{' + f'"state": "{state}", "text": "⛽ {basefee}"' + '}' -print(text)