Skip to content

Instantly share code, notes, and snippets.

View RPGillespie6's full-sized avatar

Bryan Gillespie RPGillespie6

View GitHub Profile
@RPGillespie6
RPGillespie6 / quicksort.py
Last active January 23, 2017 02:51
Simple quicksort implementation in python
# A = Array
# s = start index
# e = end index
# p = pivot index
# g = greater than pivot boundary index
def swap(A,i1,i2):
A[i1], A[i2] = A[i2], A[i1]
def partition(A,g,p):
@RPGillespie6
RPGillespie6 / batch_rename.py
Created July 12, 2020 00:47
Batch Rename Files
import os
import sys
alpha_enum = "abcdefghijklmnopqrstuvwxyz"
sorted_files = sorted(sys.argv[1:])
def printFiles(files, header="Files:"):
print(header)
for i, f in enumerate(files):
print(f"{i+1}) {os.path.basename(f)}")
@RPGillespie6
RPGillespie6 / jsonc_to_json.py
Created August 16, 2022 21:30
Convert JSONC to JSON from stdin or file
#!/usr/bin/env python3
# Convert a JSONC (JSON with Comments) file to vanilla JSON from CLI
#
# Sample usage:
# cat sample.jsonc | ./scripts/jsonc_to_json.py | jq
# python3 jsonc_to_json.py sample.jsonc
import re
import sys
@RPGillespie6
RPGillespie6 / ssssg.py
Created January 30, 2022 17:59
Super Simple Static Site Generator (SSSSG)
#!/usr/bin/env python3
"""
Author: Bryan Gillespie
License: MIT
Super Simple Static Site Generator (SSSSG)
A tiny Markdown -> HTML converter
"""
import os
import re