Skip to content

Instantly share code, notes, and snippets.

@snejus
snejus / colorize_help
Last active June 24, 2024 20:45
Highlight any help text in the stdin.
# Highlight any help text in the stdin.
# It has been tested with various command line tools and should be able to handle most
# of them regardless of the language or framework used to write them.
#
# Since this is just a sed pattern, it works in any shell. For example, in my zsh setup
# I have a global alias
#
# export LESS=-FR # enable colors, exit if contents fit in one screen
# alias -g h='--help |& colorize_help | less'
#
@snejus
snejus / deps
Last active July 1, 2024 14:18
See python package's direct and reverse dependencies, and version changes between revisions in milliseconds
#!/bin/bash
# Read poetry.lock and display information about dependencies:
#
# * Project dependencies
# * Sub-dependencies and reverse dependencies of packages
# * Summary of updates, or change in dependency versions between two revisions of the project
#
# Author: Sarunas Nejus, 2021
# License: MIT
@snejus
snejus / changelog
Last active June 3, 2022 02:54
Find and print the changelog of a python package
#!/usr/bin/env bash
# Try finding the changelog of a Python package and render it with glow (markdown) or
# pygments (md and rst), if they are installed.
#
# Tested with bash and zsh. It isn't POSIX-compatible however.
#
# ### clone the gist
# $ chmod a+x changelog
# $ ln -is `realpath changelog` ~/.local/bin/changelog