Skip to content

Instantly share code, notes, and snippets.

View tigerhawkvok's full-sized avatar

Philip Kahn tigerhawkvok

View GitHub Profile
@tigerhawkvok
tigerhawkvok / ImageDeTiler.py
Last active March 20, 2024 16:53 — forked from will-hart/README.md
Stitch together tilemaps into a single image
#!python3
"""
A simple script which converts all the images in
the folder it is run from into a single image.
Images should be in a directory <searchDir>, with
the tiles binned into folders based on their
Y-axis identity, named as their X-axis identity.
In other words, they should be folders of rows
containing column-items for that row of images.
@tigerhawkvok
tigerhawkvok / poetry-convert.py
Last active February 23, 2024 22:40
Convert a requirements.txt file to a Poetry project
#!python3
"""
Convert a requirements.txt file to a Poetry project.
Just place in the root of your working directory and run!
"""
sourceFile = "./requirements.txt"
import re
import os
@tigerhawkvok
tigerhawkvok / restartAudio.bat
Created March 4, 2016 20:30
Restart Windows Audio Service (with admin permissions, if needed)
rem Written for buggy audio drivers that need to be restarted
rem In my case, the Claro 8.18 drivers bug out every once in a while on Windows 10, and need restarting to not sound poppy
@echo off
goto check_Permissions
:check_Permissions
echo Administrative permissions required to run this script. Checking...
net session >nul 2>&1
@tigerhawkvok
tigerhawkvok / getChocoInstalledPath.py
Last active December 11, 2023 00:53
Get the installation path for a package installed by Chocolatey
#!python3
"""
Script and function to get the path of a chocolatey install
matching the `pathComponent`, or, if none provided, the
last installed path.
@author Philip Kahn
@date 20230614
@license MIT
@url https://gist.github.com/tigerhawkvok/aad3f184b37bb869df5bd337d4b4c22e
@tigerhawkvok
tigerhawkvok / unLFS.py
Last active September 5, 2023 13:25
Remove LFS from a directory
#!python3
"""
Remove LFS tracked files and change them to normal git
Python 3.8+, native code
For Python <= 3.7, move the Literal and Final imports from "typing" to third-party module "typing_extensions"
@author Philip Kahn
@url https://gist.github.com/tigerhawkvok/adb7905a2423312f237da1953d6a8eeb
@tigerhawkvok
tigerhawkvok / prettifySql.py
Created March 1, 2022 00:02
Take in a dirty SQL file formatted who knows how and get it mostly formatted
#!python3
"""
Quick and dirty SQL beautifier
"""
FILEPATH = "buildWDTables.sql"
TABSIZE = 4
#######################################################
@tigerhawkvok
tigerhawkvok / WSLmounter.sh
Created August 5, 2021 18:34
Mount a removable drive in WSL
# Works in .bashrc too
# Mount the D: drive
test -r /mnt/d || eval "$(sudo mkdir /mnt/d)"
test -r /mnt/d/'System Volume Information' || eval "$(sudo mount -t drvfs D: /mnt/d)"
test -r /mnt/d/'System Volume Information' && echo 'D: successfully mounted' || echo 'Failed to mount removable drive'
@tigerhawkvok
tigerhawkvok / optimizeImages.py
Created July 27, 2021 23:24
Optimize images in a directory to reasonable quality without killing space
#!python3
"""
Opens all .jpg files in a folder and
downsamples them to maximum 1280 pixels wide
and quality level 75
"""
import glob
import os
from skimage.io import imread, imsave
@tigerhawkvok
tigerhawkvok / pyproject.toml
Last active July 5, 2021 04:56
Webify a directory of images
[tool.poetry]
name = "webImages"
version = "0.1.0"
description = "Scales all images in a directory and preps for web use"
authors = ["Philip Kahn <tigerhawkvok@gmail.com>"]
license = "MIT"
[tool.poetry.dependencies]
python = "^3.7"
scikit-image = "~0.19.0"
@tigerhawkvok
tigerhawkvok / cleanupGitHere.py
Last active July 1, 2021 19:25
Clean up a directory of Git projects
#!python3
"""
Cleanup all top level git directories here.
Creates a powershell or bash script to then execute
https://gist.github.com/tigerhawkvok/2161ef3aead495420fc84588ec50b6a3
Python 3.7+
"""
#pylint: disable= line-too-long, invalid-name