Skip to content

Instantly share code, notes, and snippets.

@Rust1667
Rust1667 / combine-all-md-files.py
Last active November 7, 2022 23:00
Python script used to combine all the .md files inside a folder into 1, adding the title of the file at the beginning of each of the joined sections. This script must be place inside that folder with the .md files.
outputFileName = 'single-page2'
import glob
filenames = glob.glob('*.md')
with open(outputFileName, 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
fileTitleString = "\n\n\n" + "# " + fname + "\n"
outfile.write(fileTitleString)
for line in infile:
@Rust1667
Rust1667 / md-search-grep.sh
Created November 7, 2022 22:51
Script for Linux, using Grep. It searches recursively all the .md files inside a folder. It uses a regular expression, so the input is 2 words, and it returns the lines containing both of those (one could be empty). Useful to search through a massive database of links saved in markdown.
# SETTINGS
readonly docsRoute=~/Documents/search-repos
# CODE
doAsearch () {
echo -------------------------------------------------------------------------------------------------------------------
echo New search. Enter the search terms [word1 and word2]:
echo word1:
read word1
echo word2:
@Rust1667
Rust1667 / update-all-repos.sh
Created November 7, 2022 22:54
Script for Linux. Updates all the git repositories in a folder.
#Get the directory right
cd ~/repos-folder
pwd
ls
echo
#Git pull everything
find . -maxdepth 1 -type d -exec sh -c '(cd {} && pwd && git pull && echo ...)' ';'
@Rust1667
Rust1667 / .gitignore
Last active July 12, 2024 11:47
Generate a markdown index with the guides found in FMHY - https://rentry.co/fmhy-guides
fmhy-guides.md
@Rust1667
Rust1667 / download_all_fmhy_rentrys.py
Last active April 6, 2024 08:10
This is a script to download all rentrys from the FreeMediaHeckYeah Wiki including the base64 page. --- Requirements: You need to have the python package "rentry" installed ("pip install rentry" or download https://github.com/radude/rentry/blob/master/rentry.py in the same folder with the example.env file from that same repo renamed as ".env"))
import os
import base64
import re
import requests
import rentry
def extract_string_from_url(url):
# Define the regular expression pattern to match the string after the last '/'
pattern = r'https://rentry\.(?:co|org)/([^/]+)$'
@Rust1667
Rust1667 / fmhy_base64_decoded.py
Created December 18, 2023 00:58
get the base64 page from FMHY decoded in plain text using Python
import requests
#----------------base64 page processing------------
import base64
import re
doBase64Decoding = True
def fix_base64_string(encoded_string):
missing_padding = len(encoded_string) % 4