This folder contains quite a few Python files, which are supposed
to be run as commands in the console and do some useful stuff.
Figure out what each script (command) does.
To run these Python scripts as native commands in your console, follow these steps.
Important
Before you begin, ensure you have Python installed and added to your system's PATH.
This is crucial for the commands to be recognized and executed.
-
Windows: make sure to check the box
Add Python to PATH
and if possibleInstall for all usersduring the installation of Python.
Verify Python is in your PATH by typingpython --versionorpy --versionin your console. -
macOS and Linux: Python is often pre-installed, but you should verify
it's in your PATH by typingpython3 --versionin your console.
Download the Python files you want to use, along with the requirements.txt file.
Place them all in a single, permanent directory on your computer. We'll call this your commands-directory.
Important
The way you prepare the files depends on your operating system:
-
Windows: You can leave the
.pyor.pywextension on the files.
As long as bothPYandPYWare in your system'sPATHEXTenvironment variable
(which is the default), you can run the commands without typing.py. -
macOS and Linux: You must remove the
.pyor.pywextension from the script files.
For example, renamex-cmds.pytox-cmds.
This allows the operating system to execute them as native commands.
Before the scripts can run, you need to install their required Python packages. 📦
- Open your console.
- Navigate to your commands-directory using the
cdcommand.cd "/path/to/your/commands-directory"
- Install the dependencies using pip:
py -m pip install --upgrade -r "requirements.txt"
This makes your commands available from any location in your console. ⚙️
- Add the commands-directory to your system's
Pathenvironment variable:- Open the Start Menu, search for "Environment Variables", and select
Edit the system environment variables. - In the
System Propertieswindow, clickEnvironment Variables.... - Under the
System variablessection, find and select thePathvariable, then clickEdit.... - Click
Newand paste in the absolute path to your commands-directory. - Click
OKto close all dialogs.
- Open the Start Menu, search for "Environment Variables", and select
- Assure correct file associations for
.pyand.pywfiles:- In the File Explorer, right-click on any
.pyfile and selectOpen with>Choose another app. - Scroll all the way down and click
Choose an app on your PC. - Navigate to your Python installation directory (e.g.
C:\Program Files\Python\), selectpython.exe, and clickOpen. - Now click on
Alwaysto set Python as the default app for.pyfiles. - Lastly, repeat the same steps for a
.pywfile, but selectpythonw.exeinstead ofpython.exeunder step 3.
- In the File Explorer, right-click on any
- Add a shebang line: Make sure the very first line of every script file is
#!/usr/bin/env python3.
(Note: This is already done for you in all the repository's files.) - Make the files executable: Open your console and run the following command, replacing the path with your own:
chmod +x "/path/to/your/commands-directory/*" - Add the directory to your console's PATH:
- For modern macOS (and Linux with Zsh), edit
~/.zshrc. - For most Linux distributions, edit
~/.bashrc. - Open the file (e.g.
nano ~/.zshrc) and add this line to the end:export PATH="$PATH:/path/to/your/commands-directory"
- Save the file, and then apply the changes by running
source ~/.zshrc(or the file you edited).
- For modern macOS (and Linux with Zsh), edit
Close and reopen your console.
The changes are now active, and you can run the files by typing their names (e.g. x-cmds). ✅
Here's a brief overview of what each script does and how to use it.
⇾ Each process can be canceled by pressing Ctrl(⌘) + C.
Note
If any of the scripts doesn't work (especially after you updated them to their latest versions),
make sure you have updated all the required dependencies to their latest versions.
For that download the latest requirements.txt file and then follow the dependencies installing steps again.
This is a better version of the cls or clear command to clear your console for a few reasons:
- the command
_is faster to type - the command actually clears the console and doesn't just scroll the content up
- the command also resets all the color and style formats
This command will capitalize all found HEX colors in the given file or directory.
The path to the file or directory containing files can be directly given as an argument:
capitalize-hex "/path/to/file"capitalize-hex "/path/to/directory"This command will give you the following info about the files in your current working directory (cwd):
- the files count
- the total files scope (lines count from all the files with text in them)
- the total size of the files
To also scan all subdirectories recursively, use the -r --recursive option:
dinfo --recursiveIt can take quite a bit of time to get this information, thus you can exclude info you don't need with the -e --exclude option.
Possible exclude values are scope and size:
dinfo --exclude='scope'dinfo --exclude='size'dinfo --exclude='scope size'The files count will always be included, since it doesn't affect the performance.
You can also decide whether hidden files/directories and/or system files/directories should be skipped with the -s --skip option.
Possible skip values are hidden and system:
dinfo --skip='hidden'dinfo --skip='system'dinfo --skip='hidden system'The last option lets you decide if .gitignore rules should be applied when getting the info, with the -g --gitignore option:
dinfo --gitignoreTo show help for the command, use the -h --help option:
dinfo --helpThis command will generate and preview a color gradient between two or more specified HEX colors.
gradient '#F00' '#00F'You can also create multicolor gradients by specifying more than two colors:
gradient 'F00' '00F' '0F0'You can specify the number of steps in the gradient with the -s --steps option:
gradient 'F00' '00F' --steps=10Per default the gradient is generated using linear RGB interpolation.
To generate the gradient using HSV color space, use the -H --hsv option:
gradient 'F00' '00F' --hsvTo generate the gradient using perceptually uniform OKLCH color space, use the -O --oklch option:
gradient 'F00' '00F' --oklchWhen using HSV or OKLCH modes, you can control the direction of hue rotation between colors using > (clockwise) or < (counterclockwise):
gradient 'F00' '<' '00F' --hsvgradient 'F00' '>' '00F' --oklchYou can combine multiple colors with different directions:
gradient 'F00' '>' '00F' '<' '0F0' --hsvTo show a list of all the colors in the generated gradient, use the -l --list option:
gradient 'F00' '00F' --listTo show step numbers alongside the listed colors, use the -n --numerate option:
gradient 'F00' '00F' --numerateTo show help for the command, use the -h --help option:
gradient --helpThis command will turn a two digit HEX value into a percentage, where FF equals 100% and 00 equals 0%.
When the command is run, it will ask you for the HEX value, but you can also give it directly as an argument:
hex-percent 'FF'This command starts a simulation of Conway's Game of Life inside the console.
This command starts a small maze game inside the console. The game controls and options are first shown at game start.
The maze will adjust itself to the dimensions of your console after each new maze generation.
This command will display an animated, random text character mess in your console with a few options for customizing:
- By standard, the matrix symbols are not colored. With the option
-c--coloryou can make them in random colors:mess --color
- Normally, the matrix moves rather slowly, but with the option
-s--speedor-f--fast, it will move very fast:mess --fast
- You can also make the matrix in color and move fast, by applying both options:
mess -c -f
This command will calculate the value of the Pi number to a certain decimal place.
To specify up to how many decimal places should be calculated, run the command with an argument:
pi 100This command simply lets you input a list of items. It will then output all the items, but each item on a new line.
In addition to that it will display some info about the items. When all the items are numbers, it will also output more info like the min, max, sum and average.
Per default, the list items are separated by a space, but this can be changed to anything else with the option -s --sep:
process-list "item1;item2;item3" --sep=';'This command will generate a truly random integer number with a specific number of digits or between a minimum and maximum value.
To generate a random integer with a specific number of digits, run the command with that number as an argument:
rand 10To generate a random integer between a minimum and maximum value, run the command with both values as arguments:
rand 0 100You can also batch generate multiple numbers at once with the option -b --batch --batch-gen:
rand 10 --batch=5To format the generated number/s with thousands-separators, use the option -f --format:
rand -1_000_000 1_000_000 --formatTo show help for the command, use the -h --help option:
rand --helpThis command will show the foreground and background colors from the current shell color scheme.
This command will just display a moving sine wave inside your console.
The rendering of the sine wave can also be inverted with the option -i --invert --inverse:
sine --invertThis command gives you the option to get a nicely formatted table with the squares of all numbers up to a certain number.
You can specify the number of table columns with the -c --cols --columns option:
squares --cols=6This command will output info about all installed Visual Studio Code extensions:
- the installed extensions count
- a list of all installed extensions
You can also output the list of installed extensions, formatted as a JSON array, with the -j --json option:
code-extensions --jsonThis command lets you do advanced calculations directly in the console. It supports a wide range of mathematical operations, functions and constants.
You can directly give the calculation as an argument:
x-calc "2 + 2 * 2"There's also an option to specify a previous answer with the -a --ans option:
x-calc "ans * 2" --ans=6You can also specify the calculation precision (result decimal places) with the -p --precision option:
x-calc "sqrt(ln(10) + 1) / cos(π / 4)" --precision=1000And yes, it can do very complex calculations:
x-calc "(((sinh(2.7) * cosh(1.3) + tanh(0.5)) / (sqrt(abs(sin(π/6) - cos(π/3))) + exp(ln(2)))) * (log10(100) + ln(e^2)) - ((fac(5) / (4! + 3!)) * (2^8 - 3^5)) + (((asin(0.5) + acos(0.5)) * atan(1)) / (sqrt(2) * sqrt(3))) + (cbrt(27) * sqrt(49) - pow(2, 10) / 1024) + ((sinh(1) + cosh(1)) / (1 + tanh(0))) * log(1000, 10) - (((sin(π/4))^2 + (cos(π/4))^2) * exp(0)) + (arctan(sqrt(3)) - arcsin(1/2)) * (log2(256) / ln(e^8)) + ((fac(6) - 5^3) / (sqrt(144) + cbrt(64))) * (sinh(0.5)^2 - cosh(0.5)^2 + 1) - (((2 * φ * sqrt(5)) / (1 + sqrt(5))) * (log(e^10) - ln(exp(10)))) + ((acos(-1) / 2 + asin(1)) * (tan(π/4) + cot(π/4))) / (sec(0) * csc(π/2))) ^ τ" --precision=1000To show help for the command, use the -h --help option:
x-calc --helpThis command lets you clean broken registry entries, environment variables, shortcuts and temp files.
To restore a backup of the environment variables, created before every command run, use the -r --restore option:
x-clean --restore "path/to/env_vars_backup.json"This command outputs a list of all custom Python commands in the current directory,
with a short description (if provided) and their params (if found).
To check new commands / command-updates and optionally directly download and install them, use the -u --update option:
x-cmds --update⇾ To adjust some update-checking-options, you can edit the CONFIG variable, inside the script file.
The update system is designed to keep managed commands up-to-date while protecting your custom files:
-
Managed Commands: Only files with the comment
#[x-cmds]: UPDATEat the top (after the shebang) are checked for updates.
These commands can be automatically updated or deleted if they're removed from the repository. -
User Commands: Files without the
#[x-cmds]: UPDATEmarker are considered user-created and
will never be modified or deleted by the update system, keeping your custom commands safe. -
Update Detection: The system checks multiple GitHub repository URLs (configurable in the script),
merges all available commands, and detects three types of changes:- New commands - available in the repository but not locally
- Updated commands - local managed commands with content changes
- Deleted commands - local managed commands no longer in any repository
This approach allows you to safely add your own commands to the directory while still benefiting from automatic updates.
Get detailed hardware information about your PC.
To get even more detailed information, use the -d --detailed option:
x-hw --detailedYou can also output the info as a JSON object with the -j --json option:
x-hw --jsonTo show help for the command, use the -h --help option:
x-hw --helpThis command will give you info about your local and public IP addresses, with optional geolocation information about the public IP address.
To include geolocation information, use the -g --geo option:
x-ip --geoTo specify a specific provider for the geolocation information, use the -p --provider option:
x-ip --geo --provider="ipinfo"You can also output the info as a JSON object with the -j --json-output option:
x-ip --json-outputTo show help for the command, use the -h --help option:
x-ip --helpThis command will list all Python modules imported across Python files in the script directory, along with some additional info.
You can exclude standard library modules with the -e --external option:
x-modules --externalTo specify a specific directory to scan, use the -d --directory option and add the -r --recursive option to scan subdirectories recursively:
x-modules --directory="./src"x-modules --directory="./src" -rTo only get the list of modules without any additional info, use the -l --list option:
x-modules --listYou can also output the info as a JSON object with the -j --json option:
x-modules --jsonThere's also the option to directly install all found external modules with pip by using the -i --install option:
x-modules --installTo show help for the command, use the -h --help option:
x-modules --helpThis command lets you quickly generate QR codes directly within the console. You also have options for generating different special QR codes:
- Wi-Fi QR codes
- Contact QR codes
These special QR codes can be generated with the options -w --wifi and -c --contact:
x-qr --wifix-qr "James Brown" --contactGenerating a normal QR code of some text, URL, etc. can be done by simply giving that text directly as an argument:
x-qr "https://example.com/"To show help for the command, use the -h --help option:
x-qr --helpThis command is used to force-delete files/directories that are locked somehow and can't be deleted with the normal rm or del commands.
The confirmation step can be skipped with the -nc --no-confirm option:
x-rm "/path/to/file-or-directory" --no-confirmTo show help for the command, use the -h --help option:
x-rm --helpThis command generates an advanced directory tree. You have the following options when running the command:
- directories to ignore in the tree (just writes
...instead of that directory's contents) - display the contents of the files (utf-8) directly included in the tree
- choose between different tree styles
- set the tree's indentation size
- output the tree into a file (if it's too large to fit inside the console history)
The directories to ignore can also be given directly via the option -i --ignore (absolute paths, relative paths or directory names, separated by |):
x-tree --ignore="/abs/to/dir1 | rel/to/dir2 | dir3"With the option -n -np --no-progress, you can disable the progress from being shown while generating the tree (might make the generation a bit faster):
x-tree --no-progressTo show help for the command, use the -h --help option:
x-tree --helpThis tool can be used to run a command and automatically copy the full output including metadata to the clipboard, after execution.
You can directly give the command to run as an argument:
xc dinfo -rTo not include the ran command in the clipboard, use the -nc --no-command option:
xc --no-command dinfo -rTo not include the metadata in the clipboard, use the -nm --no-metadata option:
xc --no-metadata x-modules -eYou can also only copy the output without metadata or command, with the -o --only option:
xc --only x-hw --detailedIf ANSI codes should be included in the clipboard output, use the -a --ansi option:
xc --ansi x-ip --geoTo show help for the command, use the -h --help option:
xc --help