Run dotvenv in an empty folder to create a virtual env from scratch and activate it immediately:
$ dotvenv
Created virtual env
Activated virtual env
(.venv) $Run again to deactivate the virtual env:
| #!/usr/bin/env bash | |
| # ============================================================================= | |
| # disk-cleanup.sh | |
| # Interactive disk cleanup for macOS and Linux. | |
| # Removes caches, Docker waste, old Node versions, stale node_modules, | |
| # and Python virtual environments. Safe to run periodically. | |
| # | |
| # Usage: | |
| # ./disk-cleanup.sh # interactive mode (approve each removal) | |
| # ./disk-cleanup.sh --force # no confirmations, remove everything |
| #!/usr/bin/env bash | |
| # | |
| # claude-commit: Use Claude Code to generate a commit message for staged changes, | |
| # then open it in the editor for review before committing. | |
| # | |
| # Usage: claude-commit [custom instruction] | |
| # | |
| # Examples: | |
| # claude-commit # Generate a standard commit message | |
| # claude-commit "detailed description" # Add custom instructions for Claude |
| #!/usr/bin/env bash | |
| # Usage: | |
| # claude-history Show the last prompt | |
| # claude-history 1 Show the last prompt | |
| # claude-history 3 Show the 3rd-to-last prompt | |
| # claude-history --last 5 Show the last 5 prompts | |
| set -euo pipefail | |
| if ! command -v jq &> /dev/null; then | |
| echo "Error: 'jq' is not installed." >&2 |
| /** | |
| * Encode the given array to JSON, avoiding float values being arbitrarily | |
| * added decimals. | |
| * | |
| * Credits to https://stackoverflow.com/questions/42981409/php7-1-json-encode-float-issue | |
| */ | |
| function safe_json_encode($array, $flags = 0) | |
| { | |
| // Set the precision to the same value as the precision setting | |
| // to avoid float values being arbitrarily added decimals. |
| import { Exchange, Order } from 'ccxt'; | |
| /** | |
| * Create a spot OCO order using CCXT implicit API for Binance. | |
| * | |
| * An OCO order (one-cancels-the-other) contains a take profit and a stop loss | |
| * order for the same amount. | |
| * | |
| * @link https://developers.binance.com/docs/binance-spot-api-docs/rest-api/trading-endpoints#new-order-list---oco-trade | |
| * |
| """ | |
| Show an image from the MNIST dataset, and print its label. | |
| Usage: show-mnist-image.py <index> <split> | |
| where | |
| - <index> is the index of the image to show (0-59999) | |
| - <split> is either 'train' or 'test' to select the specific MNIST dataset | |
| Example: |
Run dotvenv in an empty folder to create a virtual env from scratch and activate it immediately:
$ dotvenv
Created virtual env
Activated virtual env
(.venv) $Run again to deactivate the virtual env:
| /** | |
| * Make images submitted via a Google Form publicly viewable. | |
| * | |
| * Updated version at https://gist.github.com/bef1b29628be234978f6d286f4e719ba | |
| * | |
| * INSTRUCTIONS | |
| * | |
| * 1. Open the response spreadsheet. | |
| * 2. Open the script editor (Tools -> Script Editor), paste the content of this | |
| * file inside the editor, and save (Ctrl+S or Cmd+S). |
| <?php | |
| /** | |
| * Add 'Reply-To' header to admin emails, so that the admin can reply | |
| * directly to the buyer; optionally add also BCC field to all emails | |
| * sent by WooCommerce (both to the customer and to the admin). | |
| * | |
| * The $object argument can be any WooCommerce object (product, order, | |
| * user...) depending on the email ID. | |
| * | |
| * Possible email IDs can be extracted from filenames in the |