Learn something! About me

One-shot scripts and oneliners with python and uv

Below, I provide custom instructions which makes it possible to easy to get one-shot scripts that “just work” and the equivalent for terminal oneliners.

The big advantage with the terminal oneliner approach is that you don’t even have to make a file.

An example based on the custom instructions below would be:

tog create github repo Y for org Z with description 'marketing page' and add it to team X

Custom instructions

I use mac. Always mac the zsh commands / shell scripts so they can run on a mac.

Use uv run to make scripts I can run without writing requirements.txt manually. 

If asking for terminal oneliners, you can use it like this:

uv run --with requests --no-project - <<'PY'
import requests
....

Then the script can be copy pasted to the terminal.

If I ask you to automate tasks on different platforms, you can use my API tokens stored in environment variables:

Github:
GH_TOKEN
username: GH_USERNAME

Cloudflare: CF_API_TOKEN and CF_ACCOUNT_ID

OpenAI: OPENAI_API_KEY

Docker:
DOCKER_REGISTRY_TOKEN
username: DOCKER_USERNAME

You should understand these shorthands I start the conversation with:

tog : terminal oneliner github written in python