From 01f885373743d923515717a0faa2ffda2569c147 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Fri, 19 Jul 2024 20:21:05 -0500 Subject: [PATCH] Remove obsolete --- archive-to-sync | 15 ----- get-fandom-wiki-urls | 133 ------------------------------------------- hn | 39 ------------- http-status-note | 16 ------ install-go-tools | 8 --- install-python-tools | 9 --- install-webdev-tools | 8 --- lispify | 32 ----------- lnav-forwarded-logs | 10 ---- refresh-doom-emacs | 7 --- rustupinst | 3 - send-matrix-webhook | 49 ---------------- zellijssh | 7 --- 13 files changed, 336 deletions(-) delete mode 100755 archive-to-sync delete mode 100755 get-fandom-wiki-urls delete mode 100755 hn delete mode 100755 http-status-note delete mode 100755 install-go-tools delete mode 100755 install-python-tools delete mode 100755 install-webdev-tools delete mode 100755 lispify delete mode 100755 lnav-forwarded-logs delete mode 100755 refresh-doom-emacs delete mode 100755 rustupinst delete mode 100755 send-matrix-webhook delete mode 100755 zellijssh diff --git a/archive-to-sync b/archive-to-sync deleted file mode 100755 index f4618d0..0000000 --- a/archive-to-sync +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -SYNC_DIR="${HOME}/sync" -archive_maybe=( - "${HOME}/sync/org" - "${HOME}/sync/org-roam" - "${HOME}/sync/sites" -) - -for dir in "${archive_maybe[@]}"; do - if [ "$(find "$dir" -type f -mtime -1 | wc -l)" -gt 0 ]; then - create-archive "$dir" - mv -v "$dir-$(date '+%Y%m%d').tar.gz" "${SYNC_DIR}/archived/" - fi -done diff --git a/get-fandom-wiki-urls b/get-fandom-wiki-urls deleted file mode 100755 index e497ec9..0000000 --- a/get-fandom-wiki-urls +++ /dev/null @@ -1,133 +0,0 @@ -#!/usr/bin/env python3 -# -# This little script makes it easy to Archive All The Things. -# It prints a list of URLs from fandom wiki pages to stdout. -# -# Stdout can then be redirected to a plaintext file with e.g: -# `get-fandom-wiki-urls cyberpunk > ~/downloads/cyberpunk-wiki-urls.txt` -# -# These URLs can then be imported directly into ArchiveBox. Each URL will -# be a page of the local sitemap. The local sitemap is a list of wiki pages -# in alphabetical order. Importing the URLs scraped by the script into -# ArchiveBox with a depth of '1' will pull every URL one hop away, so every -# wiki page listed in the local sitemap will be archived. -# -# This script wouldn't be necessary if there was a way to view the entire -# local sitemap in one html page. Then all you'd have to do is import the -# URL for the local sitemap into ArchiveBox with a depth of '1'. As far I -# know there is no way to get this view of the local sitemap. For some -# unknown reason the Wiki fandom site developers didn't design the frontend -# to enable that. -# -# LICENSE -# This is free and unencumbered software released into the public domain. -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. - -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. - -# THE SOFTWARE IS PROVIDED \AS IS\, WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -# For more information, please refer to - -import sys - -import requests -from bs4 import BeautifulSoup - - -def get_hop0_urls(fandom: str) -> list(): - starting_url = "https://" + fandom + ".fandom.com/wiki/Local_Sitemap" - hop0_urls = [starting_url] - - while True: - reqs = requests.get(starting_url) - soup = BeautifulSoup(reqs.text, "html.parser") - mw_allpages_nav = soup.find_all("div", {"class": "mw-allpages-nav"})[0] - - if ( - len(mw_allpages_nav.find_all("a")) < 2 - and "Next page" not in mw_allpages_nav.find_all("a")[0].get_text() - ): - break - else: - if len(mw_allpages_nav.find_all("a")) < 2: - starting_url = ( - "https://" - + fandom - + ".fandom.com" - + mw_allpages_nav.find_all("a")[0].get("href") - ) - else: - starting_url = ( - "https://" - + fandom - + ".fandom.com" - + mw_allpages_nav.find_all("a")[1].get("href") - ) - - hop0_urls.append(starting_url) - - return hop0_urls - - -def get_hop1_urls(hop0_urls: list) -> list(): - hop1_urls = list() - - for url in hop0_urls: - reqs = requests.get(url) - soup = BeautifulSoup(reqs.text, "html.parser") - fandom = url.split(sep="/wiki")[0] - - for item in soup.find_all("a"): - if item.get("href") and item.get("href").startswith("/wiki"): - hop1_urls.append(fandom + item.get("href")) - - return hop1_urls - - -def help_message(): - supported_wikis = ["cyberpunk", "dishonored", "dragonage", "forgottenrealms", "masseffect", "residentevil"] - print("Supply a fandom wiki name as arg1.\n") - print("Currently supported wikis:") - for wiki in supported_wikis: - print("- %s" % wiki) - - -if __name__ == "__main__": - - if len(sys.argv) > 1: - match sys.argv[1]: - case "cyberpunk": - urls = get_hop1_urls(get_hop0_urls("cyberpunk")) - case "dishonored": - urls = get_hop1_urls(get_hop0_urls("dishonored")) - case "dragonage": - urls = get_hop1_urls(get_hop0_urls("dragonage")) - case "forgottenrealms": - urls = get_hop1_urls(get_hop0_urls("forgottenrealms")) - case "masseffect": - urls = get_hop1_urls(get_hop0_urls("masseffect")) - case "residentevil": - urls = get_hop1_urls(get_hop0_urls("residentevil")) - case _: - help_message() - - for url in urls: - print(url) - else: - help_message() diff --git a/hn b/hn deleted file mode 100755 index e4a4a4e..0000000 --- a/hn +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env bash - -# LICENSE -# Copyright 2022 Jeffrey Serio -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -if ! test -x "$(command -v gum)"; then - echo "Missing dependency: gum" - echo "See github.com/charmbracelet/gum" - exit 1 -fi - -selection=$(python3 <(cat </dev/null || echo "$selection" diff --git a/http-status-note b/http-status-note deleted file mode 100755 index 1e91b34..0000000 --- a/http-status-note +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -source /usr/local/etc/matrix-webhook-env - -for url in "${site_urls[@]}"; do - status_code=$(curl -o /dev/null -s -w "%{http_code}" "$url") - if [ "$status_code" = 200 ] && ! [ "$status_code" == "302" ]; then - if ! /usr/local/bin/send-matrix-webhook "$room_id" "$url: ✅ UP"; then - echo "Error sending webhook to Matrix" - exit 1 - fi - else if ! /usr/local/bin/send-matrix-webhook "$room_id" "$url: ❌ DOWN"; then - echo "Error sending webhook to Matrix" - exit 1 - fi -done diff --git a/install-go-tools b/install-go-tools deleted file mode 100755 index 92071cb..0000000 --- a/install-go-tools +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -go install golang.org/x/tools/gopls@latest -go install github.com/fatih/gomodifytags@latest -go install github.com/cweill/gotests/...@latest -go install github.com/x-motemen/gore/cmd/gore@latest -go install golang.org/x/tools/cmd/guru@latest -go install github.com/gohugoio/hugo@latest diff --git a/install-python-tools b/install-python-tools deleted file mode 100755 index 692c573..0000000 --- a/install-python-tools +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -pipx install --include-deps ansible -pipx install black -pipx install pyflakes -pipx install isort -pipx install pipenv -pipx install nose -pipx install pytest diff --git a/install-webdev-tools b/install-webdev-tools deleted file mode 100755 index 63615f3..0000000 --- a/install-webdev-tools +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -sudo npm install -g @catppuccin/inkcat -sudo npm install -g prettier -sudo npm install -g js-beautify -sudo npm install -g stylelint - -sudo dnf install -y tidy diff --git a/lispify b/lispify deleted file mode 100755 index eee0e10..0000000 --- a/lispify +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -# Check for an argument -if [ $# -eq 0 ]; then - echo "Usage: $0 filename" - exit 1 -fi - -# A function to convert a string to Lisp case, including converting spaces to a single dash -to_lisp_case() { - echo "$1" | awk '{ gsub(/[ _]+/, "-"); print tolower($0) }' | sed 's/[A-Z]/-\L&/g' | sed 's/^-//' -} - -# The filename is the first argument -file="$1" - -# Check if the file exists -if [ ! -f "$file" ]; then - echo "Error: File does not exist." - exit 1 -fi - -# Convert the filename to Lisp case -new_name=$(to_lisp_case "$file") - -# Rename the file if the new name is different from the original -if [ "$file" != "$new_name" ]; then - mv -- "$file" "$new_name" - echo "File renamed to $new_name" -else - echo "File name is already in the desired format." -fi diff --git a/lnav-forwarded-logs b/lnav-forwarded-logs deleted file mode 100755 index a660c43..0000000 --- a/lnav-forwarded-logs +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -FORWARDED_LOGS=$(sudo find /var/log -type f -name "forwarded-logs.log") - -if [[ -n "$FORWARDED_LOGS" ]]; then - echo "$FORWARDED_LOGS" | xargs sudo lnav -else - echo "No forwarded logs found in /var/log" - exit 1 -fi diff --git a/refresh-doom-emacs b/refresh-doom-emacs deleted file mode 100755 index 33d8ee1..0000000 --- a/refresh-doom-emacs +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Sometimes things get weird and you just have to do this - -rm -rf "${HOME}/.config/emacs" -git clone --depth 1 https://github.com/doomemacs/doomemacs "${HOME}/.config/emacs" -"${HOME}/.config/emacs/bin/doom" install --force --verbose diff --git a/rustupinst b/rustupinst deleted file mode 100755 index 18664a9..0000000 --- a/rustupinst +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh diff --git a/send-matrix-webhook b/send-matrix-webhook deleted file mode 100755 index 3e96591..0000000 --- a/send-matrix-webhook +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -import json -import sys - -import requests - - -def send_matrix_webhook(access_token, room_id, message, user_id_to_ping, matrix_server): - """ - Send a message to a Matrix room using a webhook. - - :param access_token: The access token for Matrix API authentication. - :param room_id: The ID of the room where the message will be sent. - :param message: The message to be sent. - :param user_id_to_ping: The user to ping in the message. - :param matrix_server: The URL of the Matrix homeserver. - """ - - headers = { - "Authorization": f"Bearer {access_token}", - "Content-Type": "application/json", - } - - full_message = f"{user_id_to_ping}: {message}" - data = { - "msgtype": "m.text", - "body": full_message, - "format": "org.matrix.custom.html", - "formatted_body": f'{user_id_to_ping}: {message}', - } - - url = f"{matrix_server}/_matrix/client/r0/rooms/{room_id}/send/m.room.message" - - response = requests.post(url, headers=headers, data=json.dumps(data)) - if response.status_code == 200: - print("Message sent successfully.") - else: - print(f"Failed to send message. Status code: {response.status_code}") - - -if __name__ == "__main__": - access_token = "" - room_id = sys.argv[1] - message = sys.argv[2] - user_id_to_ping = "" - matrix_server = "" - - send_matrix_webhook(access_token, room_id, message, user_id_to_ping, matrix_server) diff --git a/zellijssh b/zellijssh deleted file mode 100755 index 68034e8..0000000 --- a/zellijssh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -if ping -c 1 "$1"; then - autossh -M 0 "$1" -else - echo "Host not reachable" -fi