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
#!/usr/bin/env uv run | |
# /// script | |
# dependencies = [ | |
# "torch>=2", | |
# ] | |
# /// | |
import functools | |
import time |
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
# coding: utf-8 | |
# @psobot on Aug 25, 2024 | |
# Usage: | |
# pbpaste | python setlistizer.py && open setlist.pdf | |
# Update the key mapping as needed. | |
# Details below specialized for https://newyacht.city | |
from reportlab.lib.pagesizes import letter | |
from reportlab.platypus import SimpleDocTemplate, Paragraph | |
from reportlab.lib.styles import ParagraphStyle |
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
""" | |
1. Record an Off-Beat Jazz rehearsal session with an Sony A7C camera | |
2. Plug in an SD card to your Mac | |
3. Run this script, which will automatically segment the rehearsal session and render | |
to lower-quality, shareable, Google Drive-able H265-encoded video files | |
4. Upload to Google Drive | |
5. Get better at playing Jazz | |
Requirements: | |
python3 -m pip install tqdm ffmpeg-python numpy ffmpeg matplotlib |
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 inspect | |
from typing import Tuple, Any | |
def search_stack_for_variable(variable_name: str, frame=None) -> Tuple[str, Any]: | |
if frame is None: | |
frame = inspect.currentframe() | |
if variable_name not in frame.f_locals: | |
if frame.f_back is None: | |
raise ValueError(f"No variable named \"{variable_name}\" found in callstack.") |
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
""" | |
Super hacky script to parse compiled Protobuf definitions out of one or more binary files. | |
Very useful if, say, you want to pull the internal data structures out of a compiled App Store app. | |
Requires `pip install 'protobuf>=3.20.0rc1'`. | |
Example usage: | |
python3 protodump.py /Applications/SomeAppBundle.app ./proto_files_go_here/ | |
(c) Peter Sobot (@psobot), March 13, 2022 |
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
""" | |
Kurzweil K2500/K2600 KOS operating system update file packer/repacker | |
by Peter Sobot, Nov 6, 2021 | |
@psobot / [email protected] | |
Requirements: none! Pure Python. Just use Python 3.2+. | |
""" | |
import os | |
import math |
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
""" | |
MIDI Sample Dump receive script | |
by Peter Sobot, Nov 6, 2021 | |
@psobot / [email protected] | |
Requirements: pip install python-rtmidi tqdm numpy pysoundfile | |
""" | |
import argparse | |
import rtmidi |
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
""" | |
Copyright (c) 2012-2016, CCL Forensics | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the |
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 | |
from glob import glob | |
class Directory(object): | |
def __init__(self, _dir=None): | |
if _dir: | |
self._dir = os.path.abspath(os.path.expanduser(_dir)) | |
else: | |
self._dir = os.path.abspath(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
""" | |
generate_k2500xs_ui.py | |
November 26, 2017 by @psobot | |
MIT licensed | |
Generates a screen image for the Kurzweil K2500XS | |
(http://www.vintagesynth.com/kurzweil/k2500.php) | |
program list and keymap can be provided on the command line with | |
--programs <program 1> <program 2>... |
NewerOlder