This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install click | |
# python itunes_xml_to_m3u.py --help | |
import logging | |
import plistlib | |
import re | |
import typing as tp | |
from pathlib import Path | |
from urllib.parse import unquote | |
import click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euxo pipefail | |
video_in="video_in.mkv" | |
video_out="video_out.mp4" | |
# full metadata payload: $(ffprobe -loglevel error -print_format json -show_format -show_streams "${video_in}") | |
is_avc=$(ffprobe -loglevel error -select_streams v:0 -show_entries stream=is_avc -of default=noprint_wrappers=1:nokey=1 "${video_in}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# original gist from pescobar/build-git.sh | |
# changes by LaggAt: | |
# * to be usable on Raspbian / tested RPi3 and | |
# * for automatic depency resolving | |
# changes by ivan-c: | |
# * add `apt-get update` | |
# changes by ddelange: | |
# * add `set -euxo pipefail` | |
# * remove `--allow-downgrades` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from collections import deque | |
from concurrent.futures import ThreadPoolExecutor | |
from functools import partial | |
from subprocess import PIPE, CalledProcessError, CompletedProcess, Popen | |
def stream_command( | |
args, | |
*, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
from concurrent.futures import ThreadPoolExecutor as _ThreadPoolExecutor | |
class ThreadPoolExecutor(_ThreadPoolExecutor): | |
"""Subclass with a lazy consuming imap method.""" | |
def imap(self, fn, *iterables, timeout=None, queued_tasks_per_worker=2): | |
"""Ordered imap that lazily consumes iterables ref https://gist.github.com/ddelange/c98b05437f80e4b16bf4fc20fde9c999.""" | |
futures, maxlen = deque(), self._max_workers * (queued_tasks_per_worker + 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install smart_open[s3] | |
from collections import deque | |
from concurrent.futures import ThreadPoolExecutor as _ThreadPoolExecutor | |
from functools import partial | |
from typing import Callable, Dict, Optional, Iterable, Iterator, Sequence | |
import boto3 | |
import botocore | |
import smart_open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import count | |
from os import environ | |
import dominate | |
import requests | |
GITHUB_API_URL = environ["GITHUB_API_URL"] | |
GITHUB_REPOSITORY = environ["GITHUB_REPOSITORY"] | |
links = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install sh pycountry | |
import re | |
from pathlib import Path | |
import pycountry | |
from sh import ffmpeg | |
def mux_mp4_subs(inp, outp, *subs, _cwd=None, **subs_map): | |
"""Mux multiple subtitle files into an mp4 file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# $ pip install pandas playwright tabulate && python -m playwright install --with-deps webkit | |
# $ GITHUB_REPOSITORY_OWNER=octocat python playwright_github_stars_lists.py | |
import asyncio | |
import os | |
from contextlib import asynccontextmanager | |
import pandas as pd | |
from playwright.async_api import async_playwright | |
from playwright.async_api._generated import Browser, Locator |
NewerOlder