Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Base URL for downloads
BASE_URL="https://data.vision.ee.ethz.ch/cvl/rrothe/imdb-wiki/static/"
# Array of filenames to download
FILES=(
"imdb_0.tar"
"imdb_1.tar"
"imdb_2.tar"
@gordinmitya
gordinmitya / bot.py
Created October 2, 2023 07:38
Python bot to get user_id by forwarded message
"""
pip install python-telegram-bot
"""
from telegram import Update
from telegram.ext import ApplicationBuilder, MessageHandler, ContextTypes
import telegram.ext.filters as filters
async def any_message_handler(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
@gordinmitya
gordinmitya / transparent_player.py
Created September 30, 2023 17:24
Player plays half-transparent video on top of other windows
"""
sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-4.0
pip install pycairo PyGObject opencv-python
"""
import cv2
import gi
import numpy as np
gi.require_version('Gtk', '3.0')
@gordinmitya
gordinmitya / numpy_sorter.py
Created September 15, 2023 16:53
find closest images by their embeddings
from dataclasses import dataclass
import numpy as np
@dataclass(frozen=True)
class Embeddings:
names: list[str]
vectors: np.ndarray
@gordinmitya
gordinmitya / config
Last active June 22, 2023 14:43
Fix terminator tab size
# ~/.config/terminator/config
[global_config]
scroll_tabbar = True
[keybindings]
switch_to_tab_1 = <Alt>1
switch_to_tab_2 = <Alt>2
switch_to_tab_3 = <Alt>3
switch_to_tab_4 = <Alt>4
switch_to_tab_5 = <Alt>5
@gordinmitya
gordinmitya / gpu_compatibility.json
Created December 2, 2022 13:01
TFLite gpu compatibility database at state 7b3867c
{
"root": [
{
"variable": "tflite.opengl_es_version",
"items": [
{
"value": "3.1",
"children": [
{
"variable": "tflite.gpu_model",
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
struct flags
{
int b, e, n, s, t, u, v;
} f = {0};
import java.util.*
fun doit(array: CharArray, left: Int, balance: Int) {
if (left == 0) {
println(Arrays.toString(array))
return
}
if (left > balance) {
array[array.size - left] = '('
doit(array, left - 1, balance + 1)
@gordinmitya
gordinmitya / pong.c
Created June 26, 2022 09:49
Ping-pong console game
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include <sys/select.h>
#include <string.h>
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
@gordinmitya
gordinmitya / .wezterm.lua
Created June 19, 2022 08:22
github.com/wez/wezterm config
-- ~/.wezterm.lua
local wezterm = require 'wezterm';
return {
keys = {
{key="w", mods="CMD", action=wezterm.action{CloseCurrentPane={confirm=true}}},
{key="d", mods="CMD", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}},
{key="d", mods="CMD|SHIFT", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}},
},
window_decorations = "RESIZE",