chore: remove unnecessary scripts
This commit is contained in:
parent
759f3cb532
commit
c476cab7d0
6 changed files with 0 additions and 148 deletions
|
@ -1,34 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Automatically pull and commit changes to remote after generating Neuron static
|
|
||||||
# site
|
|
||||||
|
|
||||||
# USER=thomas
|
|
||||||
# export XDG_RUNTIME_DIR=/run/user/1000
|
|
||||||
# source /home/thomas/.env
|
|
||||||
|
|
||||||
SLACK_NOTIFIER="${HOME}/repos/utilities/slack_notifier.sh"
|
|
||||||
NEURON_GENERATOR="${HOME}/repos/neuron-zk-generator/dist/neuron-zk-generator"
|
|
||||||
|
|
||||||
cd "${HOME}/repos/eolas"
|
|
||||||
|
|
||||||
echo "Checking for changes..."
|
|
||||||
git pull >/dev/null 2>&1
|
|
||||||
changes_exist="$(git status --porcelain | wc -l)"
|
|
||||||
|
|
||||||
# If no changes, exit. Else commit and push with timestamp
|
|
||||||
if [ "$changes_exist" -eq 0 ]; then
|
|
||||||
echo "No changes, exiting"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Run Neuron generator
|
|
||||||
$NEURON_GENERATOR
|
|
||||||
|
|
||||||
echo "Changes exist. Updating remote..."
|
|
||||||
git pull >/dev/null 2>&1
|
|
||||||
git add .
|
|
||||||
git commit -q -m "Autosave: $(date +"%Y-%m-%d %H:%M:%S")"
|
|
||||||
git push
|
|
||||||
|
|
||||||
$SLACK_NOTIFIER "eolas" 'success' 'eolas: auto-save executed'
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Convert hypens in file names to underscores
|
|
||||||
|
|
||||||
main() {
|
|
||||||
find . -depth -name '*.md' | while read fname; do
|
|
||||||
new_fname=$(echo "$fname" | tr " -" "_")
|
|
||||||
if [ -e "$new_fname" ]; then
|
|
||||||
continue
|
|
||||||
echo "No filename change needed"
|
|
||||||
else
|
|
||||||
echo "Creating new file $new_fname to replace $fname"
|
|
||||||
mv "$fname" "$new_fname"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run and pipe errors and feedback to logfile
|
|
||||||
|
|
||||||
# &>/dev/null
|
|
||||||
main
|
|
|
@ -1,35 +0,0 @@
|
||||||
# Flatten markdown links such that depth is reduced to /link.md
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
|
|
||||||
def trim_markdown_links(filepath):
|
|
||||||
with open(filepath, "r") as file:
|
|
||||||
content = file.read()
|
|
||||||
|
|
||||||
# Regular expression to match Markdown links
|
|
||||||
pattern = r"\[([^\]]+)\]\(([^)]+)\)"
|
|
||||||
links = re.findall(pattern, content)
|
|
||||||
|
|
||||||
# For each link, extract the filename and replace the link
|
|
||||||
for text, link in links:
|
|
||||||
link_filename = os.path.basename(link)
|
|
||||||
content = content.replace(f"[{text}]({link})", f"[{text}]({link_filename})")
|
|
||||||
|
|
||||||
# Write the modified content back to the file
|
|
||||||
with open(filepath, "w") as file:
|
|
||||||
file.write(content)
|
|
||||||
|
|
||||||
|
|
||||||
def process_directory(directory):
|
|
||||||
for filename in os.listdir(directory):
|
|
||||||
if filename.endswith(".md"):
|
|
||||||
trim_markdown_links(os.path.join(directory, filename))
|
|
||||||
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
# process_directory('/path/to/your/directory')
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
process_directory("/home/thomas/repos/eolas/zk")
|
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This script returns a random topic for me to revise
|
|
||||||
|
|
||||||
# It is aliased to cs-revise in .zshrc
|
|
||||||
|
|
||||||
# Choose source directories...
|
|
||||||
directories_to_parse="../Computer_Architecture ../Databases ../Electronics_and_Hardware ../Operating_Systems ../Programming_Languages ../DevOps"
|
|
||||||
|
|
||||||
# Return array of all files belonging to source dirs...
|
|
||||||
for ele in $directories_to_parse; do
|
|
||||||
file_matches+=( $(find $ele -name "*.md" -type f) )
|
|
||||||
done
|
|
||||||
|
|
||||||
# Generate a random integer between 0 and the match array length...
|
|
||||||
random_file_index=$(( $RANDOM % ${#file_matches[@]} + 0 ))
|
|
||||||
|
|
||||||
# Return file matching that index...
|
|
||||||
echo "Revise this topic: ${file_matches[$random_file_index]}"
|
|
|
@ -1,28 +0,0 @@
|
||||||
# Remove 'title' and 'categories' from Yaml frontmatter of old entries
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
# Define the directory
|
|
||||||
directory = "/home/thomas/repos/eolas/zk"
|
|
||||||
|
|
||||||
# Define the regex patterns
|
|
||||||
title_pattern = re.compile(r"title:.*\n")
|
|
||||||
categories_pattern = re.compile(r"categories:.*\n(\s*-.*\n)*")
|
|
||||||
|
|
||||||
# Iterate over all files in the directory
|
|
||||||
for filename in os.listdir(directory):
|
|
||||||
# Check if the file is a markdown file
|
|
||||||
if filename.endswith(".md"):
|
|
||||||
# Open the file
|
|
||||||
with open(os.path.join(directory, filename), "r+") as file:
|
|
||||||
# Read the file content
|
|
||||||
content = file.read()
|
|
||||||
# Remove the 'title' and 'categories' sections
|
|
||||||
content = title_pattern.sub("", content)
|
|
||||||
# content = categories_pattern.sub("", content)
|
|
||||||
# Seek to the beginning of the file
|
|
||||||
file.seek(0)
|
|
||||||
# Write the modified content back to the file
|
|
||||||
file.write(content)
|
|
||||||
# Truncate the file to remove any remaining old content
|
|
||||||
file.truncate()
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Replace all instances of `img` in Markdown image links with `_img` (to reflect new directory structure)
|
|
||||||
|
|
||||||
find /home/thomas/repos/eolas/ -type f -name "*.md" | while
|
|
||||||
read file; do
|
|
||||||
sed -i 's/\/_img\//\/img\//g' $file
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue