Skip to content

Instantly share code, notes, and snippets.

View researcx's full-sized avatar
💼
Looking for work

Keira T. researcx

💼
Looking for work
View GitHub Profile
@researcx
researcx / flist-formatter.py
Created March 27, 2024 21:49
export f-list preferences to plain/readable html
import sys
from bs4 import BeautifulSoup
# usage: python3 flist-formatter.py character-page.html > output.html
file_read = sys.argv[1]
sections = ["Character_FetishlistFave", "Character_FetishlistYes", "Character_FetishlistMaybe", "Character_FetishlistNo"]
with open(file_read, 'r') as f:
import json, shlex, sys
from subprocess import Popen
caption = sys.argv[1]
image_caption = ""
if len(sys.argv) == 4:
image_caption = sys.argv[3]
social_media = sys.argv[2].split(',')
is_image = False
@researcx
researcx / weatherscript.sh
Created September 25, 2023 12:48
adjust cpu frequency based on time and weather
#!/bin/bash
LAT=53.3963308
LON=-1.5155923
JSON=$(curl -s "https://api.open-meteo.com/v1/forecast?latitude=$LAT&longitude=$LON&current_weather=true")
WEATHERCODE=$(echo $JSON | jq -r '.current_weather.weathercode') # WMO weather interpretation code
IS_DAY=$(echo $JSON | jq -r '.current_weather.is_day') # 1 if the current time step has daylight, 0 at night.
#echo -e "\033[1;33mDBG: IS_DAY=$IS_DAY\033[0m"
#echo -e "\033[1;33mDBG: WEATHERCODE=$WEATHERCODE\033[0m" # 0 for clear sky, 1 for mainly clear, 2 for partly cloudy (see https://open-meteo.com/en/docs#weathervariables)

Embeddable dynamic images:

PHP:

NGINX line:

location /example.png {
	include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php8.1-fpm.sock;
}
@researcx
researcx / Auto Filename.md
Last active July 24, 2023 08:31
Automator imageboard style filenames rename Finder Quick Action

Automator -> New Quick Action

Workflow receives current files or folders in any application

Image: Documents

Get Selected Finder Items

Run Shell Script Shell: /bin/zsh - Pass Input: as arguments

@researcx
researcx / statuscheck.js
Created July 2, 2023 15:03
javascript check for live site mirrors and redirect to an archive.today archive if none available
var cachebuster = Math.round(new Date().getTime() / 1000);
var check_file = "static/files/.thumbnails/Imagedump/7cbe510033142eb7943d5b21ca251759fee64292f9f4e86eda9fd4c793343621-150.png?v=" + cachebuster;
var sites = {"https://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.tor.pm/": "false",
"https://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion.re/": "false",
"https://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion.pet/": "false",
"http://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion.ws/": "false",
"http://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion.to/": "false",
"https://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion.foundation/": "false"};
var archive = ["https://archive.is/newest/http://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7ad.onion/",
"https://archive.today/newest/http://7ug46mpbiaurogeospr3vx5kh4ad7bkiduqv7nyvtlm5awkdsve2z7a
@researcx
researcx / datetime.sh
Created March 20, 2023 09:04
multiple timezone date-time display
#!/bin/bash
# example:
#  sh ./datetime.sh
#  Monday 2023/03/20 09:01 UTC (GMT: 09:01 +0000 PDT: 02:01 -0700 CET: 10:01 +0100 UTC: 09:01 +0000)
timeZones=("Europe/London America/Vancouver Europe/Zurich Finland/Helsinki")
dateTime=$(date +"%A %Y/%m/%d %H:%M %Z")
get_timezone(){
dateTimeZoneGet=`echo -n $dateTimeZoneGet; TZ=":$1" date +" %Z: %H:%M %z"`
@researcx
researcx / angristan-dns-fix.sh
Created March 12, 2023 08:04
angristan openvpn dns resolution fix on certain servers
# changes the systemd service to load the openvpn iptables rules after the network has come up
sed -i "s|Before|After|i" /etc/systemd/system/iptables-openvpn.service
systemctl daemon-reload
systemctl restart iptables-openvpn.service
@researcx
researcx / proxmox-backup.sh
Last active May 31, 2023 19:20
proxmox containers backup
#!/bin/bash -l
# set -x
# make sure you have zip installed
# running: /path/to/proxmox-backup.sh [0/1]
# use 0 for debugging, 1 to run
# gist.github.com/researcx
# configuration
backups_folder="/Backups/Pi/$hostname" # needs to exist
@researcx
researcx / githubrepos.py
Last active September 27, 2022 15:29
periodically make a html page of your github repos (requires github cli tools (gh command))
import json, humanize, os, html
from datetime import datetime, timedelta
file = '/home/keira/Repositories/Public/github.html'
github_json_file = '/home/keira/Resources/github.json'
# cron every 30 minutes:
# */30 * * * * /usr/bin/gh repo list researcx -L 400 --visibility public --json name,owner,pushedAt,isFork,diskUsage,description > /home/keira/Resources/github.json
# */31 * * * * /usr/bin/python3 /home/keira/Scripts/githubrepos.py