Metadata-Version: 2.4
Name: skilleter_extras
Version: 0.1.1
Summary: A collection of useful personal utilities, separated from the core skilleter-thingy package
Author-email: John Skilleter <john@skilleter.org.uk>
Project-URL: Home, https://skilleter.org.uk
Project-URL: Repository, https://gitlab.com/skilleter/skilleter-extras
Project-URL: Issues, https://gitlab.com/skilleter/skilleter-extras/-/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: skilleter-modules
Requires-Dist: psutil
Requires-Dist: pillow
Requires-Dist: imagehash
Requires-Dist: python-dateutil
Requires-Dist: requests
Requires-Dist: PyYAML
Requires-Dist: filetype
Dynamic: license-file

# Skilleter-Extras

Licence: GPL v3

Author: John Skilleter v0.99

Collection of miscellaneous, developer-orientated utilities for Linux and MacOS. Untested on other operating systems.

Permanently (for the foreseeable future!) in a beta stage - usable, with a few rough edges, and probably with bugs when used in way I'm not expecting!

# IMPORTANT

## Script relocation

Some scripts have been moved here from the `skilleter-thingy` package, which is now more focussed on Git-related functionality.

If you already have the `skilleter-thingy` package installed (version 0.3.42 or older) then you should use the `--force` option when installing `skilleter-extras` to ensure that the symlinks for these scripts are updated to point to the `skilleter-extras` version.

## Script deprecation

The `gphotosync` script has been deprecated as Google Photos API no longer allows all photos or videos to be downloaded

# General Commands

## addpath

Add or remove entries from a path list (e.g. as used by the PATH environment variable)

    usage: addpath [-h] [--add ADD] [--prefix PREFIX] [--suffix SUFFIX] [--remove REMOVE] [--separator SEPARATOR] path

    Add or remove entries from a path list (e.g. as used by the PATH environment variable)

    positional arguments:
      path                  The path to modify

    options:
      -h, --help            show this help message and exit
      --add ADD             Add an entry to the front of the path (do nothing if it is already present in the path)
      --prefix PREFIX       Add an entry to the front of the path (or move it there if it is already present)
      --suffix SUFFIX       Add an entry to the end of the path (or move it there if it is already present)
      --remove REMOVE       Remove an entry from the path (do nothing if it is not present
      --separator SEPARATOR Override the default path separator

## borger

Wrapper for the borg backup utility to make it easier to use with a fixed set of options.

## console_colours

Alias: `consolecolours`

Display all available colours in the console.

## diskspacecheck

Check how much free space is available on all filesystems, ignoring read-only filesystems, /dev and tmpfs.

Issue a warning if any are above 90% used.

## docker-purge

Stop or kill docker instances and/or remove docker images.

## ffind

Simple file find utility - replaces the `find` command with something that is more human-friendly.

    ffind [-h] [--path PATH] [--long] [--colour] [--no-colour] [--all] [--zero] [--iname] [--follow] [--git] [--diff] [--regex] [--fullpath] [--human-readable] [--grep GREP] [--abspath]
                [--unquoted] [--quiet] [--invert] [--exec EXEC] [--count] [--count-only] [--type TYPE] [--file] [--dir] [--block] [--char] [--pipe] [--symlink] [--socket] [--any] [--verbose]
                [--debug]
                [patterns ...]

    positional arguments:
      patterns              List of things to search for.

    options:
      -h, --help            show this help message and exit
      --path PATH, -p PATH  Search the specified path, rather than the current directory
      --long, -l            Output details of any files that match (cannot be used with -0/--zero)
      --colour, -C, --color
                            Colourise output even if not outputting to the terminal
      --no-colour, -N, --no-color
                            Never colourise output
      --all                 Search all directories (do not skip .git, and similar control directories)
      --zero, -0            Output results separated by NUL characters
      --iname, -i           Perform case-independent search
      --follow, -F          Follow symlinks
      --git, -g             Only search for objects in the current git repository
      --diff, -D, --diffuse
                            Run Diffuse to on all the found objects (files only)
      --regex, -R           Use regex matching rather than globbing
      --fullpath, -P        Match the entire path, rather than just the filename
      --human-readable, -H  When reporting results in long format, use human-readable sizes
      --grep GREP, -G GREP  Only report files that contain text that matches the specified regular expression
      --abspath, -A         Report the absolute path to matching entities, rather than the relative path
      --unquoted, -U        Do not use quotation marks around results containing spaces
      --quiet, -q           Do not report permission errors that prevented a complete search
      --invert, -I          Invert the wildcard - list files that do not match
      --exec EXEC, -x EXEC  Execute the specified command on each match (optionally use ^ to mark the position of the filename)
      --count, -K           Report the number of objects found
      --count-only, -c      Just report the number of objects found
      --type TYPE, -t TYPE  Type of item(s) to include in the results, where b=block device, c=character device, d=directory, p=pipe, f=file, l=symlink, s=socket. Defaults to files and directories
      --file, -f            Include files in the results (the default if no other type specified)
      --dir, -d             Include directories in the results
      --block               Include block devices in the results
      --char                Include character devices in the results
      --pipe                Include pipes in the results
      --symlink, --link     Include symbolic links in the results
      --socket              Include sockets in the results
      --any, -a             Include all types of item (the default unless specific types specified)
      --verbose, -v         Output verbose data
      --debug               Output debug data

## linecount

Summarise number of files, lines of text and total size of files in a directory tree

    usage: linecount [-h] [--ext]

    options:
      -h, --help  show this help message and exit
      --ext, -e   Identify file type using the file extension (faster but less accurate)

## moviemover

Search for files matching a wildcard in a directory tree and move them to an equivalent location in a different tree

## py-audit

Query api.osv.dev to determine whether a specified version of a particular Python package is subject to known security vulnerabilities

    py-audit [-h] [requirements ...]

    positional arguments:
      requirements  The requirements file (if not specified, then the script searches for a requirements.txt file)

    options:
      -h, --help    show this help message and exit

## phototidier

Perform various tidying operations on a directory full of photos:

* Remove leading '$' and '_' from filenames
* Move files in hidden directories up 1 level
* If the EXIF data in a photo indicates that it was taken on date that doesn't match the name of the directory it is stored in (in YYYY-MM-DD format) then it is moved to the correct directory, creating it if necessary.

All move/rename operations are carried out safely with the file being moved having
a numeric suffix added to the name if it conflicts with an existing file.

## photodupe

Hash photos to find closely-similar images and report them

## remdir

Recursively delete empty directories

    remdir [-h] [--dry-run] [--debug] [--verbose] [--ignore IGNORE] [--keep KEEP] dirs [dirs ...]

    positional arguments:
      dirs                  Directories to prune

    options:
      -h, --help            show this help message and exit
      --dry-run, -D         Dry-run - report what would be done without doing anything
      --debug               Output debug information
      --verbose             Output verbose information
      --ignore IGNORE, -I IGNORE
                            Files to ignore when considering whether a directory is empty
      --keep KEEP, -K KEEP  Directories that should be kept even if they are empty

## rpylint

Run pylint on all the Python source files in a directory tree

    usage: rpylint [-h] [paths ...]

    positional arguments:
      paths       List of files or paths to lint

    options:
      -h, --help  show this help message and exit

## splitpics

Copy a directory full of pictures to a destination, creating subdirectories with a fixed number of pictures in each in the destination directory for use with FAT filesystems and digital photo frames.

## strreplace

Simple search and replace utility for those times when trying to escape characters in a regexp to use sed is more hassle than it is worth.

  strreplace [-h] [--inplace] search replace [infile] [outfile]

  positional arguments:
    search         Search text
    replace        Replacement text
    infile         Input file
    outfile        Output file

  options:
    -h, --help     show this help message and exit
    --inplace, -i  Do an in-place search and replace on the input file

## tfparse

Read JSON Terraform output and convert back to human-readable text

This allows multiple errors and warnings to be reported as there's no way of doing this directly from Terraform

    usage: tfparse [-h] [--abspath] [infile ...]

    positional arguments:
      infile         The error file (defaults to standard input if not specified)

    options:
      -h, --help     show this help message and exit
      --abspath, -a  Output absolute file paths

## trimpath

Intelligently trim a path to fit a given width (used by gitprompt)

## venv-create

Create a script to create/update a virtual environment and run a python script in it.

    usage: venv-create [-h] name

    positional arguments:
      name        Name of the script to create

    options:
      -h, --help  show this help message and exit

## window-rename

## xchmod

Command to run chmod only on files that need it (only modifies files that don't have the required permissions already).

    usage: xchmod [-h] [--debug] [--verbose] [--recursive] mode paths [paths ...]

    positional arguments:
      mode             Mode to set
      paths            List of directory paths to search

    options:
      -h, --help       show this help message and exit
      --debug          Output the list of files (if any) that need to be made publicly writeable
      --verbose        List files as they are updated
      --recursive, -R  Operate recursively

## yamlcheck

YAML validator - checks that a file is valid YAML (use yamllint to verify that it is nicely-formatted YAML).

    usage: yamlcheck [-h] [--dump] [--block] [--flow] [--hiera] files [files ...]

    positional arguments:
      files       YAML source file

    options:
      -h, --help  show this help message and exit
      --dump      Dump the YAML data after parsing it
      --block     Force block style when dumping the YAML data
      --flow      Force flow style when dumping the YAML data
      --hiera     Process the file as Puppet Hiera data
