scripts
This repository holds a collection of over 400 scripts, utilities and libraries for Unix-like operating systems, written in the following languages:
- Awk
- Bash
- C
- C++
- POSIX Shell
- Perl
- Python
- Rust
- execline
Installation
To install for your user:
git submodule update --init --recursive
make install
To install system-wide (recommended):
git submodule update --init --recursive
sudo make install
You may change the installation directory by setting $PREFIX
.
If you would like to use the provided wrapper scripts, add $PREFIX/bin/wrapper
to your $PATH
with higher priority than the locations of the wrapped scripts.
Some scripts also require $PREFIX/share/scripts/include
to be in your path.
Uninstallation
If you installed for your user:
make uninstall
If you installed system-wide:
sudo make uninstall
You do not need to re-set $PREFIX
while uninstalling.
If you altered your $PATH
, you may also wish to undo it.
Usage
See man COMMAND
, COMMAND -h
or COMMAND --help
. Simple programs/scripts do
not have man pages or help dialogues, either infer usage from their names, or see
the source code.
Notable Scripts and Utilities
- afgrep: Like
grep -F
, but supports alignment and offset. - bspwm-autokblayout: Automatically switch between keyboard layouts for different windows in bspwm.
- bspwmpad: Dynamic scratch pads for
bspwm. For optimum operation, include
seq 0 9 | while IFS= read -r i; do bspc rule -a "*:bspwmpad$i" state=floating hidden=true; done
in yourbspwmrc
. bspwm is not required for operation, but the script was designed with it in mind. There is also dwmpad. - cast: Cast data between different data types.
- clplog: Log clipboard history.
- clplogynk: Use
rofi
to yank an element from the clipboard history. - contexec: Continuously execute a file every time it is modified. This is especially useful if you are iteratively processing data using an interpreted or hot-compiled language.
- eln: Batch edit or create symlinks.
- expandpath: Like
wordexp
, but only expands~
. - ffmw:
ffmpeg
wrapper for common actions. - fmaps: Map standard input per given key-value pairs.
- kdialog: Wrapper for KDE's
kdialog
to trick applications into usinglf
as the file picker. - latexd: Basically
latexmk
but more minimal. - mapexec: Open standard input in
$EDITOR
and execute commands against all, modified, unmodified or wiped lines synchronously or asynchronously. Basically batch, but more versatile. - maptouch: Map touchscreen and stylus devices to the
touch-enabled display. Best used in
.xinitrc
or as audev
rule. Here's an example rule for Microsoft Surface Pen EYU-000001 and ASUS ROG Flow X13 GVE301RC:ACTION=="change", KERNEL=="hid-0018:04F3:2C82.0002-battery", SUBSYSTEM=="power_supply", DRIVER=="", ENV{MAPTOUCH_ROOT_DEVNAME}="ELAN9008:00 04F3:2C82", ENV{XRH_EDP}="eDP-1", RUN+="/usr/local/bin/maptouch"
. - mkparent: Create the parent directories of a path.
- neomuttpick: Use
kdialog to pick attachments in
neomutt
. Addmacro compose A "<shell-escape>neomuttpick<enter><enter-command>source /tmp/neomuttpick<enter>" "Attach With File Manager"
to yourmuttrc
file to use. - notiflog: Log notifications on the dbus interface
org.freedesktop.Notifications
. Supports locking logging: after initiating the lock, the next notification is not logged. Then it unlocks itself automatically. Supports blacklisting: certain notifications can be blacklisted and logged to a different file. - numsh: A NumPy-like interface for the shell.
- rgb24togray: Convert RGB24 images/video to greyscale with selectable algorithms.
- scratchpad: Take and manage notes with
vim
anddmenu
. Can be used withdwmpad
orbspwmpad
. - selfl: Select a file or directory with
$MENU
. - shufr: Like
shuf -r
, but supports outputting unique sequences. - std::unordered_map: Wrapper for
std::unordered_map<std::string, std::string>
for shells. - std::vector: Wrapper for
std::vector<std::string>
for shells. - stest: Filter a list of files by properties. This
is a superset of the
stest
included with suckless'dmenu
. - sumsize: Sum human readable or raw sizes.
- tglapp: Toggle an application on/off based on
hash codes. Originally written for toggling applications with the same hotkey
via
sxhkd
. - unexpandpath: Undo
expandpath
. - wordexp: Perform word expansion like a POSIX shell.
- xins: Like
xargs
but for standard input.
Environment Variables
Some scripts use optional or mandatory environment variables for applications.
Assign either bspwmpad
or dwmpad
to $PAD
, rofi -dmenu
or dmenu
to
$MENU
, and the respective application will be used. Other used variables
include: $BROWSER
, $EDITOR
, $OPENER
, $PAGER
, $SHELL
, $TERMINAL
,
$VPN
, $_BROWSER
. Some scripts will not respect these as they use
application-specific options, such as rofi -font
or st -d
.
In all shell scripts, if you set $SHELL_VERBOSE
to greater than 0, set -x
is
executed and all executed commands are printed to standard error.
Caveats
- Some scripts assume that some of the other scripts are in your
$PATH
. - None of the scripts pre-check for the availability of their dependencies.
- In some scripts, GNU extensions like
sed -i
orstrcasestr
are used. - Some scripts were written with only Linux in mind, although they may be compatible with other Unixes and Unix-likes, or may be ported with minimal modification.
- All scripts/programs are only tested on Linux.
- C code are only tested with GCC & clang, and C++ code are only tested with GCC. Most C/C++ programs should be compatible with any POSIX/ISO-conforming compilers. Some programs use non-standard GNU/LLVM extensions.
License
Unless otherwise stated, all software found in this repository are licensed under the MIT License. See the LICENSE file for details.