Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import re
import subprocess as sp
from dataclasses import dataclass
from os import listdir, path, readlink
from sys import argv, platform
from typing import Dict, List, TypedDict
#!/usr/bin/env python3
"""A single-file program for assigning icons to filenames in the `catppuccin.catppuccin-vsc-icons` vscode extension."""
import argparse
from dataclasses import dataclass
from os import listdir, path
from typing import List
class Colours:
"""ANSI color codes"""
#!/usr/bin/env py
"""
Python wrapper for the create-shortcut command packaged with 'git' on windows.
Based on https://superuser.com/a/1571247
"""
import argparse
import subprocess as sp
from dataclasses import dataclass
@YUKI2eN3e
YUKI2eN3e / colors.py
Created October 16, 2023 22:47 — forked from rene-d/colors.py
ANSI color codes in Python
# SGR color constants
# rene-d 2018
class Colors:
""" ANSI color codes """
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
#!/usr/bin/env python3
"""
mediainfo, grep, and ffmpeg must be in your path for this to work
"""
import argparse
import subprocess as sp
from dataclasses import dataclass
from os import path
from typing import List
#!/usr/bin/env python3
import argparse
from dataclasses import dataclass
from math import floor, log, pow
from os import path, walk
from typing import List
@dataclass
class CliArgs:
@ECHO OFF
REM You need to first install https://github.com/pnappa/CLImage
IF "%~1"=="" GOTO HELP
FOR /F "usebackq tokens=2* delims=: " %%W IN (`mode con ^| findstr Columns`) DO SET CONSOLE_WIDTH=%%W
SET /a modulo=%CONSOLE_WIDTH% %% 2
IF NOT [%module%] == [0] (
#!/usr/bin/env py
import argparse
import json
import os
from dataclasses import dataclass
from typing import Dict, List
from rich.console import Console, ConsoleOptions, RenderResult
from rich.table import Column, Table
from rich.text import Text
#!/usr/bin/env python3.10
""" shrink-video.py
Required:
ffmpeg (with libx265 and libfdk_aac)
set-thumbnail (a script that takes the video_filename and the thumbnail_filename in that order)
mediainfo
recycle (command that sends file to the Recycle Bin)
Notes:
Only tested on windows.
#!/usr/bin/env python3
from sys import argv
import subprocess as sp
import os
def win2unix_path(path: str) -> str:
"""Convert \\ to /
Args: