Scripts of various kinds (but also other scripts)
Find a file
2025-12-10 00:46:30 +01:00
deno download_youtube_playlist 2025-12-10 00:46:30 +01:00
python complete restructuring, and nixify 2025-10-31 15:18:22 +01:00
.gitignore fix script create_aliases 2025-10-31 15:33:25 +01:00
README.md remove magic 2025-10-31 23:43:58 +01:00

Scripts! just scripts!

A collection of utility scripts in various languages (Deno/TypeScript, Python, Node.js), nixified for easy execution.

Prerequisites

Just Nix - that's it! Each script bundles its own dependencies.

Usage

Scripts are now organized by language in subdirectories. Run them directly from their respective folders:

# Clone the repo
git clone https://github.com/JulianNymark/scripts.git
cd scripts

# Run any script - Nix will fetch dependencies automatically
./deno/nix-search-formatter.ts <search-term>
./deno/thumbnailify_cwd.ts
./python/image_to_uint16_array_4bpc_GBAR.py input.png -o output.txt

First run will be slow as Nix downloads dependencies, but subsequent runs are instant.

Scripts

  • deno/nix-search-formatter.ts - Formats nix search output for easier reading (Deno)
  • deno/thumbnailify_cwd.ts - Creates thumbnails for images and videos in current directory (Deno, ffmpeg)
  • python/image_to_uint16_array_4bpc_GBAR.py - Converts images to uint16 arrays (Python, PIL, numpy)

Adding New Scripts

  1. Create your script with a nix-shell shebang at the top:

TypeScript/Deno:

#!/usr/bin/env nix-shell
/*
#! nix-shell -i "deno run --allow-read --allow-write" -p deno
*/

// your code here

Python:

#!/usr/bin/env nix-shell
#! nix-shell -i python3 -p "python3.withPackages (ps: [ ps.numpy ps.pillow ])"

# your code here

Node.js:

#!/usr/bin/env nix-shell
/*
#! nix-shell -i node -p nodejs
*/

// your code here

Bash:

#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq ffmpeg

# your code here
  1. Make it executable: chmod +x your-script.ext
  2. Run it: ./your-script.ext

That's it! No flake updates needed. Each script manages its own dependencies.

How It Works

The nix-shell shebang tells Nix:

  • -i <interpreter>: What interpreter to use
  • -p <packages>: What packages to provide in the environment

Nix creates an isolated environment with exactly those dependencies, then runs your script.