Skip to content

Instantly share code, notes, and snippets.

@robkorv
robkorv / merge-spans.js
Created October 2, 2025 15:07
merge descendant spans that have the same style (might be needed with ckeditor content)
// create an array from spans that are a direct child of a non-span element
Array.from(document.querySelectorAll("*:not(span) > span"))
// filter out those that do not have a span in it's descendants
.filter((x) => x.querySelectorAll("span").length)
.map((x) =>
// map the result to arrays of descendent spans
Array.from(x.querySelectorAll("span"))
// reverse the array, so we work from the deepest span
.toReversed()
.filter(
@robkorv
robkorv / timezone.py
Created October 29, 2024 09:00
convert a time to specific timezones
#!/usr/bin/env python3
import datetime
import zoneinfo
eu_zone = zoneinfo.ZoneInfo(key="Europe/Amsterdam")
ru_zone = zoneinfo.ZoneInfo(key="Europe/Moscow")
na_zone = zoneinfo.ZoneInfo(key="America/Chicago")
au_zone = zoneinfo.ZoneInfo(key="Australia/Melbourne")
jp_zone = zoneinfo.ZoneInfo(key="Asia/Tokyo")
@robkorv
robkorv / split-excel.py
Created January 6, 2023 10:56
split large excel into multiple files with python's openpyxl
#!/usr/bin/env python3
import math
import pathlib
import openpyxl
file = pathlib.Path("filepath")
print(f"{file.name = }")
file_suffix = file.suffix
print(f"{file_suffix = }")
@robkorv
robkorv / clips.py
Created May 19, 2021 10:54
download clips from your twitch channel
#!/usr/bin/env python3
# https://docs.python.org/3.6/library/os.html
import os
# https://docs.python.org/3.6/library/urllib.parse.html#url-parsing
from urllib.parse import unquote, urlparse
# https://docs.python-requests.org/en/master/
import requests
@robkorv
robkorv / issue_slug
Last active December 24, 2020 10:22
issue_slug
#!/usr/bin/env python3
import shlex
import subprocess
import sys
import click
import slugify
@click.command()
#!/usr/bin/env python3
import argparse
import locale
import pathlib
import faker
import openpyxl
def main(amount):
# http://avisynth.nl/index.php/Main_Page
## files
rob_f = "robkorv-pov.mkv"
born_f = "bornnnie-pov.mkv"
## index it https://github.com/FFMS/ffms2/blob/master/doc/ffms2-avisynth.md#limitations
FFIndex(rob_f)
FFIndex(born_f)
@robkorv
robkorv / gapps-config-dev.txt
Last active May 19, 2017 08:07
stock variant
Include
# dev phone install
# Pico+
DialerFramework # Install Dialer Framework
CalSync # Install Google Calendar Sync (except if Google Calendar is being installed)
GoogleTTS # Install Google Text-to-Speech (Micro+ on 5.0-, Pico+ on 6.0+)
PackageInstallerGoogle # Install Google Package Installer
@robkorv
robkorv / backup.sh
Last active July 30, 2020 11:57
rsync backup files a dir with resume
# -v, --verbose increase verbosity
# -r, --recursive recurse into directories
# -t, --times preserve modification times
# -h, --human-readable output numbers in a human-readable format
# -P same as --partial --progress
rsync -vrthP SRC DEST
@robkorv
robkorv / git-tips-and-tricks.md
Created December 9, 2016 12:04
git-tips-and-tricks