Skip to content

Instantly share code, notes, and snippets.

View stuaxo's full-sized avatar
💭
 

Stuart Axon stuaxo

💭
 
View GitHub Profile
@stuaxo
stuaxo / dirtogpt.py
Last active April 18, 2024 22:13
List filenames and content ready for input to a LLM - optionally copy to the clipboard with a prompt.
#!/usr/bin/env python3
# Usage: python dirtogpt.py [--dir /path/to/directory] [--glob *.py] [--prompt [Custom prompt]] [--copy] [--exclude *.pyc]
import argparse
import pathlib
import fnmatch
try:
import pyperclip
@stuaxo
stuaxo / pypy-nightly.sh
Last active October 11, 2023 21:38
Download pypy builds and install to virtualenvs in ~/.virtualenvs
#!/bin/bash
set -e
# Download PyPy nightly builds and create a virtualenvs in ~./.virtualenvs
# Branch names, space seperated.
BRANCHES=(py3.10)
PLATFORM=linux64
VARIANT=pypy-c-jit
BUILD=${VARIANT}-latest-${PLATFORM}
@stuaxo
stuaxo / asio-sdk-installed.sh
Created August 31, 2015 18:30
Download and install steinberg ASIO SDK.
#!/bin/bash
## Heavily based on the android-sdk installed at https://gist.github.com/tahl/1026610
# Uses dtrx to extract the archive with a sane name
# Creates a symlink in /usr/local/asio-sdk to the version installed
i=$(cat /proc/$PPID/cmdline)
if [[ $UID != 0 ]]; then
@stuaxo
stuaxo / utm-linux-vm-playbook.md
Last active August 10, 2023 17:19
Ubuntu VM in a Mac Host [QEmu with UTM frontend]
@stuaxo
stuaxo / yield_exception_value.py
Last active July 16, 2023 00:57
yield exception, value
"""
generators and yield eat exceptions, you can catch them and pass them out though.
>>> contrived_example()
2
3
invisible is not a known colour
"""
def contrived_example():
@stuaxo
stuaxo / hyperlink.sh
Last active July 16, 2023 00:57
Output OSC-8 hyperlink in the terminal
@stuaxo
stuaxo / download-ow1.9.sh
Last active July 16, 2023 00:57
Install openwatcom-1.9 on Linux
#!/bin/bash
#
# Download open watcom 1.9 from sourceforge.
#
# Requires curl or wget
FILENAME="open-watcom-c-linux-1.9"
URL="https://master.dl.sourceforge.net/project/openwatcom/open-watcom-1.9/$FILENAME"
# Check if curl is available
if command -v curl >/dev/null 2>&1; then
@stuaxo
stuaxo / download_file.sh
Last active July 16, 2023 00:56
Download a file using intermediate .part file and automatically resume.
#!/bin/bash
# Function to handle the download
download_file() {
local delete_flag="${1:-false}"
local url="$2"
local filename="$3"
# Extract filename from URL if not provided
if [ -z "$filename" ]; then
@stuaxo
stuaxo / download-gist.sh
Last active May 15, 2023 22:08
Download all files in a github gist to the current directory
#!/bin/bash
#
# Download all the files in a GitHub Gist
#
# Example usage:
# $ download-gist.sh https://gist.github.com/stuaxo/2e110aaa42050490ad3fd73cfbedf76a
#
# By default, files are not overwritten. The -f option overrides this behavior:
# $ download-gist.sh -f https://gist.github.com/stuaxo/2e110aaa42050490ad3fd73cfbedf76a
#
@stuaxo
stuaxo / processify.py
Last active April 29, 2023 21:20 — forked from schlamar/processify.py
processify
# modified from https://gist.github.com/schlamar/2311116#file-processify-py-L17
# also see http://stackoverflow.com/questions/2046603/is-it-possible-to-run-function-in-a-subprocess-without-threading-or-writing-a-se
import inspect
import os
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue