A Bash script that compresses CBR and CBZ comic book files by converting images to WebP format while maintaining optimal quality and proper aspect ratios for two-page spreads.
- Supports both CBR, CBZ and PDF formats - Extracts and repacks comic books
- WebP conversion - Reduces file size by 80-90% while maintaining good quality
- Smart two-page spread detection - Maintains proper height for wide images
- Configurable quality and size - Adjust compression settings as needed
| /** | |
| * Debounce a function, i.e. wait for a certain amount of time before executing the function. | |
| * Often used when frequent edits would trigger a function multiple times, you can use this to | |
| * wait for a certain amount of time before executing the function. | |
| * | |
| * @param func The function to be debounced. | |
| * @param delay The delay in milliseconds for the debounce. | |
| * @returns A function that debounces the original function. | |
| * @example const debouncedFunc = debounce(myFunction, 100); debouncedFunc(args); |
Create a tab-like experience using 'pills', based on this CodePen.
m(TabPills, {
tabs: [
{This repository contains PowerShell scripts to help configure and run a multi-node Docker Swarm cluster using WSL2 on Windows 11, without relying on Docker Desktop. If you need GPU access in your swarm, please read Tom Lankhort's gist.
These scripts automate:
- Port forwarding using
netsh(TCP and UDP) - Generation of
config.tomlforwsl2proxy - Service installation and startup of
wsl2proxy - Docker Swarm initialization (manager)
| services: | |
| traefik: # Your Traefik service name as defined in your compose file | |
| image: traefik:v3.3.6 # Use the specific version | |
| command: | |
| # Enable the API and Dashboard without TLS | |
| - --api.insecure=true | |
| # Listen on the 'web' entrypoint (HTTP) on the new internal port 8091 | |
| - --entrypoints.web.address=:8091 | |
| # Listen on the 'dashboard' entrypoint on the new internal port 8092 | |
| - --entrypoints.dashboard.address=:8092 |
A simple emoji component that you can add to your page. It converts a positive score to a happy green face and a negative score to a disappointed red face.
A simple thermometer component that you can add to your page. It converts a Likert scale score to a fill percentage (0% is empty, 100% is full), and it varies the color between blue and red.
TypeScript highlighter that takes a data object, and applies a highlighting function to selected property values.
I needed to render a data object representing an article. Before rendering it to HTML, I wanted to mark certain parts of the text with a background color.
- Create string or regex-based highlighters descriptions
- Create a factory function that takes these highlighters and converts them to functions that will wrap matching text with an HTML mark element and background color. It returns a highlighter.
- Use the highlighter to convert the original data object to a data object with the same shape, but where matching text is highlighted.
| import { registerPlugin } from 'mithril-ui-form'; | |
| import { searchSelectPlugin } from './search-select-plugin'; | |
| // Register plugin under the name `search_select` or any other name of your choosing. | |
| registerPlugin('search_select', searchSelectPlugin); |

