Skip to content

Instantly share code, notes, and snippets.

Cursor Movement

  • Ctrl+A - Move the cursor to the beginning of the line.
  • Ctrl+E - Move the cursor to the end of the line.
  • Ctrl+B - Move the cursor backward one character (left).
  • Ctrl+F - Move the cursor forward one character (right).
  • Alt+B - Move the cursor backward one word.
  • Alt+F - Move the cursor forward one word.

Editing Text

  • Ctrl+U - Cut (delete) everything from the cursor to the beginning of the line.
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
config.color_scheme = 'Catppuccin Frappe'
config.initial_rows = 24
config.initial_cols = 80
config.font = wezterm.font('JetBrains Mono', { weight = 600 })
config.font_size = 16.0
#!/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 / 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))