Skip to content

Instantly share code, notes, and snippets.

View ruanimal's full-sized avatar
🤪

Ponder ruanimal

🤪
View GitHub Profile
@ruanimal
ruanimal / medis-export.py
Created June 12, 2023 09:16
migrate config from medis to AnotherRedisDesktopManager
import base64
import os
import json
from sqlalchemy import create_engine
path = os.path.expanduser('~/Library/Containers/li.zihua.medis/Data/Library/Application Support/Medis/Local Storage/file__0.localstorage')
engine = create_engine(f'sqlite:///{path}')
res = engine.execute("select * from main.ItemTable where `key`='favorites'").fetchone()
res = dict(res)
old = json.loads(res['value'])
@ruanimal
ruanimal / cloudflare-update-dns.sh
Created September 18, 2022 04:35
certbot-renew-cloudflare
#!/bin/bash
# usage: /usr/bin/certbot renew --manual-auth-hook="/root/cloudflare-update-dns.sh" --post-hook "nginx -s reload"
if [[ -z "$(command -v dig)" || -z "$(command -v jq)" || -z "$(command -v curl)" ]]; then
apt install dnsutils jq curl -y
fi
DIR="$(dirname "$0")"
CHALLENGE_DOMAIN="_acme-challenge.${CERTBOT_DOMAIN}"