Skip to content

Instantly share code, notes, and snippets.

View Bobronium's full-sized avatar
🤘
All units, rock‘n’roll!

Arseny Boykov Bobronium

🤘
All units, rock‘n’roll!
View GitHub Profile
@Bobronium
Bobronium / README.md
Last active May 7, 2024 14:31
Save any Vault published via Obsidian Publish locally

Example usage

curl -sSL https://gist.githubusercontent.com/Bobronium/fcf958f0e8257e069bc6c254f8e3858d/raw/67cab9f85748903e4e98fad286681326d2afbd3c/obsidian_publish_scrapper.py
pipx run /tmp/obsidian_publish_crawler.py https://notesonai.com/Notes+on+AI -p /tmp/notes_on_ai
@Bobronium
Bobronium / typeid.py
Created March 5, 2024 13:51
Python TypeID implementation
from collections.abc import Sequence
from functools import cached_property
from typing import Any
from typing import ClassVar
from typing import LiteralString
from uuid import UUID
from uuid_utils import uuid7
ALPHABET = "0123456789abcdefghjkmnpqrstvwxyz"
@Bobronium
Bobronium / video_fragment_to_tg_with_subs.sh
Last active May 29, 2022 21:45
Cut out fragment of a video with burned subtitles for Telegram
input_file=in.mp4
output_file="${input_file%%.*}"-fragment."${input_file##*.}"
subs_file= # can be srt file or mkv container with subtitles
start_from=
stop_at=
duration=
# delete lines below that contain empty optional variables from above before use
# if duration is specified, '-to' or 'stop_at' is ignored
ffmpeg \
@Bobronium
Bobronium / FastTelethon.py
Created February 6, 2022 18:20 — forked from painor/FastTelethon.py
This will increase the download/upload speed when using telethon
# copied from https://github.com/tulir/mautrix-telegram/blob/master/mautrix_telegram/util/parallel_file_transfer.py
# Copyright (C) 2021 Tulir Asokan
import asyncio
import hashlib
import inspect
import logging
import math
import os
from collections import defaultdict
from typing import Optional, List, AsyncGenerator, Union, Awaitable, DefaultDict, Tuple, BinaryIO
@Bobronium
Bobronium / better_minecraft_experience.md
Last active February 10, 2021 16:32
Better Minecraft Experience (Java Edition)

Better Minecraft Experience (Java Edition)

This is a list of various mods I use that make Minecraft experience ~1000 times better

Huge thanks to LambdAurora for his Recommended OptiFine alternatives on Fabric gist.

Installation

  1. Download and install Fabric
  2. Download any mods from list below and put them in .minecraft/mods folder

All mods in this list are compatible with each other, unless it stated otherwise

@Bobronium
Bobronium / make_crud.py
Last active September 21, 2024 10:35
FastAPI CRUD fabric to reduce amount of boilerplate code
import inspect
from functools import partial
from typing import Type, Literal, Callable, Dict, TypeVar, List
from fastapi import APIRouter, Depends
# import your database base model here
# from db_model import BaseDBModel
# this part is a bit outdated since you can now use SQLModel
ATTR_ACCESS:
Testing with 10000 repeats, result is average of 10 tests:

    >>> NewEnum.foo  # 0.6069349023270748 ms
    <NewEnum.foo: 1>

    >>> OldEnum.foo  # 4.5089948174334005 ms
    <OldEnum.foo: 1>
ATTR_ACCESS:
Testing with 1000000 repeats:
>>> Qrator.FOO # 0.04096488799999998 seconds
<Qrator.FOO: FOO>
>>> BuiltinPatched.FOO # 0.038564896999999654 seconds
<BuiltinPatched.FOO: 'FOO'>
import unittest
def find_longest_unique_substring(string: str) -> int:
"""
Returns length of the longest substring of unique characters
"""
max_length = 0
current_substr_chars = set()
start_index = leading_index = 0
from dataclasses import dataclass
from enum import Enum
from timeit import timeit
from typing import NamedTuple
from pydantic import BaseModel
from pydantic.dataclasses import dataclass as pydantic_dataclass
class Model(BaseModel):