This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note - This is a messy v1 of the script and needs a lot of cleaning up | |
# It works fine but it's not nice | |
"""Convert all images and videos to a lower quality/resolution to save storage space. | |
EXIF data is kept intact. | |
Warning: Do not delete your original photos! The output from this is low quality. | |
Setup: | |
1. Copy `ente-convert.py` to somewhere on the system path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Set the Immortals of Aveum sensitivity value to anything. | |
It works outside the range of the sensitivity slider, and possibly with more precision. | |
""" | |
import os | |
import struct | |
PATH = os.path.expandvars('%LOCALAPPDATA%/P3/Saved/SaveGames/GameSettings.sav') | |
with open(PATH, 'rb') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
import win32crypt # Requires pywin32 package | |
_group = '(?P<{}>{}+)' | |
WORKBENCH_PATTERN = '{dbm}@{host}:{port}\2{user}\3{password}'.format( | |
dbm=_group.format('dbm', r'\w'), | |
host=_group.format('host', r'[\w\.-]'), | |
port=_group.format('port', r'\d'), | |
user=_group.format('user', r'[\w\.-]'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
# Open the JSON file and read its contents | |
print('Loading data...') | |
with open('Records.json') as json_file: | |
data = json.load(json_file) | |
# Create a CSV file and write the headers | |
print('Processing data...') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Download all reddit posts on a users page. | |
This is a basic script I mashed together. Nothing else I found seemed to | |
work well, so I added support for all the media types I came across. | |
The code isn't particularly clean or optimised, but it gets the job done. | |
What you need to do: | |
- Create `rdl-user.bat` file and put it on the system path: | |
@echo off | |
py "%~dp0%~n0.py" %* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Very small changes to an existing script, copying here for personal use | |
# Run file from next to the .git folder | |
import subprocess, shlex | |
import sys, os.path | |
os.chdir(os.path.dirname(__file__)) | |
filelist = set() | |
for path in (sys.argv[1:] or [os.getcwd()]): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE FUNCTION `format_bytes` (val float) | |
RETURNS varchar(20) | |
DETERMINISTIC | |
CONTAINS SQL | |
BEGIN | |
DECLARE pw smallint; | |
IF val < 1024 THEN | |
return CONCAT(val, ' B'); | |
END IF; | |
SET pw = LEAST(7, FLOOR(LOG(val) / LOG(1024))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick script to mirror folders using Google Drive File Sync. | |
# Built for transferring VR game saves from a laptop to my main PC. | |
# For example, to keep Firefox in sync, create a "G:/My Drive/Firefox" | |
# directory, copy this script and create two batch files: | |
# upload.bat: py quicksync.py upload %APPDATA%/Mozilla/Firefox | |
# download.bat: py quicksync.py download %APPDATA%/Mozilla/Firefox | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Get import dependencies using PyInstaller. | |
The node types can be used to check for instances. | |
A brief description of the main ones are below: | |
MissingModule: An imported module that cannot be found. | |
Attributes: | |
identifier (str) | |
Example: | |
MissingModule('invalid.module',) |
NewerOlder