Skip to content

Instantly share code, notes, and snippets.

@duodecanol
duodecanol / png-to-webp.bash
Created February 20, 2026 05:27
Convert png to webp subfolders using parallel and cwebp
find . -name "*.png" -print0 | parallel -0 ' [14:26:20]
dir=$(dirname {})
file=$(basename {})
parent_dir=$(basename "$dir")
new_basepath="${parent_dir}-webp"
mkdir -p "${new_basepath}"
new_name="${new_basepath}/${file}"
cwebp -q 100 {} -o "${new_name}.webp"
'
@duodecanol
duodecanol / ground_test_parking_lot.py
Last active January 25, 2024 01:45
ground-test-parking-lot
from typing import Any, Generator
import asyncio
import functools
import json
import random
import time
from http import HTTPStatus
from pathlib import Path
import aiohttp
@duodecanol
duodecanol / get-all-object-versions.sh
Last active January 15, 2024 05:46
get all object versions of a file in a s3 bucket
#!/bin/bash
# Example: `./get-all-object-versions.sh -b jeonju-cctv --key "prod/4-5_10.png"`
#Read the argument values
while [[ "$#" -gt 0 ]]
do
case $1 in
-b|--bucket) BUCKET="$2"; shift;;
-k|--key) SEARCH_KEY="$2"; shift;;
@duodecanol
duodecanol / AddThisToUserFormCode.vb
Last active October 29, 2021 05:16
MS Word VBA Snippets
Private Sub ListBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
HookListBoxScroll
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
UnhookListBoxScroll
End Sub
@duodecanol
duodecanol / single_dispatch_example.py
Created November 3, 2020 10:33 — forked from bradmontgomery/single_dispatch_example.py
Example of single dispatch in python. This is seriously cool stuff.
"""
Playing with python's single dispatch.
See: https://hynek.me/articles/serialization/
See also PEP 443: https://www.python.org/dev/peps/pep-0443/
"""
from datetime import datetime
from functools import singledispatch