In my daily workflow, I use some codes that help me work better. Feel free to modify, improve, and use them for your purpose.
A simple Bash script to batch convert images (JPG, JPEG, PNG) to WebP format with a quality setting of 50, using cwebp
.
-
Features:
- Converts JPG, JPEG, and PNG images to WebP.
- Configurable input and output directories via command-line arguments.
- Automatically creates output directory if it doesn’t exist.
-
Usage:
- Run the script with or without specifying directories:
./convert_to_webp.sh /path/to/your/images /path/to/your/output
- If no arguments are provided, it defaults to
input
andoutput_webp_50
directories.
- Run the script with or without specifying directories:
A function to convert WSL paths to Windows format, making it easier to navigate files between WSL and Windows.
-
Features:
- Converts WSL paths to Windows paths automatically.
- Copies the converted path to the clipboard for easy access.
-
Usage:
- Add the function to your
.bashrc
or.zshrc
file. - Run the converter in the Terminal:
wsl2win /home/<username>/path/to/file
- Add the function to your
A collection of VS Code snippets to streamline the process of generating Jekyll URLs and Markdown links.
-
Features:
- Quick generation of Jekyll relative URLs and Markdown links.
- Easy to use with predefined snippets.
-
Usage:
- Install the snippets in your Markdown user snippets file.
- Use the prefixes (
jurl
,jlink
,jpost
) in your Markdown files to expand the snippets.
Open a PR and share your own code, whether it is completely new or an improvement.