Skip to content

Instantly share code, notes, and snippets.

@skarfie123
skarfie123 / workona_to_bookmarks.py
Created February 2, 2024 23:21
Convert Workona export to bookmarks.
import typer
from pydantic import BaseModel, ConfigDict, Field
class NoExtrasModel(BaseModel):
model_config = ConfigDict(extra="forbid")
class User(NoExtrasModel):
name: str
@skarfie123
skarfie123 / bmp_to_png.py
Created September 2, 2023 21:15
convert BMP images to PNG
import os
from PIL import Image
def main():
input_folder = "output"
# List all files in the input folder
bmp_files = [f for f in os.listdir(input_folder) if f.lower().endswith(".bmp")]
@skarfie123
skarfie123 / edl_to_yt.py
Created September 1, 2023 22:21
Convert Davinci Resolve timeline markers EDL to YouTube timestamps. Based on https://github.com/MaximRouiller/edl-to-ytjs
import re
import typer
def main(edl_file: str):
with open(edl_file, encoding="utf-8") as f:
lines = f.readlines()
regex_timestamp = r"\d{3,4} \d{3,4} V C \d{2}:(?P<marker_timestamp>\d{2}:\d{2}):\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2} \d{2}:\d{2}:\d{2}:\d{2}"
@skarfie123
skarfie123 / suffix.ps1
Created August 5, 2023 11:43
add suffix to files in a folder
# Add suffix in place
Get-ChildItem -Recurse | Where-Object { !$_.PSIsContainer } | ForEach-Object {
Rename-Item $_.FullName -NewName "$($_.BaseName)-$($_.Directory.Name)$($_.Extension)"
}
# Move to parent with suffix
Get-ChildItem -Recurse | Where-Object { !$_.PSIsContainer } | ForEach-Object {
Move-Item $_.FullName -Destination "$($_.Directory.Parent.FullName)\$($_.BaseName)-$($_.Directory.Name)$($_.Extension)"
}
@skarfie123
skarfie123 / edit_video.py
Created August 7, 2022 21:26
extract segments from video clips and concatenate
import os
import subprocess
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
clip_times = {
"clip1.mp4": [
((2, 12), (2, 20)),
((2, 25), (2, 35)),
],
@skarfie123
skarfie123 / pep8_naming_conventions.py
Created June 17, 2021 17:30
PEP8 Naming Conventions Examples
# https://www.python.org/dev/peps/pep-0008/#naming-conventions
# short lowercase module and package names
# underscores if needed, but discouraged for packages
# package.my_module ie package\my_module.py
from typing import TypeVar
# CapWords for Type Variable names, and preferably short
VT_co = TypeVar("VT_co", covariant=True)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@skarfie123
skarfie123 / detectron2-pdm.ipynb
Created June 1, 2021 10:23
Detectron2 PDM.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@skarfie123
skarfie123 / colours.cmd
Last active June 27, 2021 09:14 — forked from k-takata/256colors2.bat
All Windows 10 Terminal Colours 🌈
@echo off
setlocal EnableDelayedExpansion
set colour1=
set colour2=
echo %colour1%---%colour2% ESC[XXm %colour1%---
@REM dark background
set str=
for /l %%c in (30,1,37) do (
@skarfie123
skarfie123 / spicetifyAdblock.css
Last active May 22, 2021 10:52
To block ads, add these lines to your Spicetify Theme. See also spotifyAdblock.hosts
.Root__main-view > div:first-of-type {
display: none;
}