Skip to content

Instantly share code, notes, and snippets.

View okurka12's full-sized avatar
♥️

Vít Pavlík okurka12

♥️
View GitHub Profile
@okurka12
okurka12 / asciify_czech.py
Last active March 15, 2024 09:39
Replaces letters with diacritics in a czech text
#
# Prints the contents of `original_string` without diacritics.
# Expects a text in czech language.
#
# Author: okurka12
#
# Date: 2024-03-11
#
PRINT_BLOAT = False
@okurka12
okurka12 / snap.bat
Created January 24, 2024 00:13
Creates a snapshot of a file.
@echo off
setlocal enabledelayedexpansion
rem
rem Usage: .\snap.bat
rem
rem Upon invocation, copies `name.ext` to `name_1.ext`.
rem If `name_1.ext` already exists, copies to `name_2.ext`,
rem then `name_3.ext` and so on...
rem
@okurka12
okurka12 / kmp_prefix.py
Created January 23, 2024 00:16
Generation of the prefix table for the Knuth-Morris-Pratt algorithm
#
# part of the knuth-morris-pratt algorithm:
# generation of the prefix table/fail vector
#
# víteček 🔥💯 (okurka12), January 2024
#
def ppre(s: str) -> set[str]:
"""returns a set of all proper prefixes of `s`"""
@okurka12
okurka12 / .bash_aliases
Last active April 4, 2024 13:20
my favorite bash aliases
#
# My favorite aliases for bash
#
# for vanilla debian installations (where there's no poweroff cmd)
alias shutdown='sudo systemctl poweroff'
alias poweroff='sudo systemctl poweroff'
# those can be uncommented directly in .bashrc but why not have it here
alias grep='grep --color=auto'
@okurka12
okurka12 / exams.py
Created December 18, 2023 07:14
decide which exams to skip to have calmer examination period
# Author: víteček 🔥💯 (okurka12)
#
# The script tries to pick the right exams according to the defined criteria
# and it does so randomly
#
# exam dates are hard-coded below in the `exams` list
#
from random import shuffle
# Wishest thou to embark upon the logging endeavor?
@okurka12
okurka12 / enviro.bat
Last active August 23, 2023 15:34
a windows batch script that opens various shells and a text editor in the specified directory
:: Author: Vit Pavlik (okurka12)
:: Date: 2023-08-23
:: this is a script `enviro.bat` to be located in %userprofile%. it's purpose
:: is to run all necessary tools/editors/shells needed for various projects
:: why %userprofile%?
:: %userprofile% where the windows run dialog's "current directory" is.
:: what I mean is programs can be run from %userprofile% with the windows
:: run dialog window, even though %usrprofile% is not in path.
@okurka12
okurka12 / c_tabular_macro.c
Created July 22, 2023 04:29
Tabulkove makro v C
/******************************************************************************/
/* TABULKOVA MAKRA */
/******************************************************************************/
/**
* tak jak nam je ukazoval dr. Peringer 2. 5. 2023 na prednasce
* pry to objevil nekde v kodu GCC
*/
#undef ROW /* to be defined later */
@okurka12
okurka12 / main.py
Created June 3, 2023 13:44
Overeni spravnosti slozeni funkci - zadane funkce pochazi ze zadani prvniho opravneho terminu IMA1 skup. G. Jinak je skript stejny jako muj prechozi gist z unora.
# skripticek na overeni spravnosti slozeni funkci
#
# (stejne jako muj predchozi gist,
# ale napsal jsem tady funkci ze zadani IMA1 2022/2023 G-opravny)
#
# autor: vitek kvitek 🌻
# datum: 2023-06-03
# funguje v poho s:
# windows 11
# python 3.10.7
@okurka12
okurka12 / newton.py
Created May 8, 2023 05:27
overeni konvergence newtonovy numericke metody pro hledani korenu polynomu
from math import sin, cos
DEPTH = 9
def f(x: float) -> float:
"""funkce f"""
return sin(x) - x**2 + 4
@okurka12
okurka12 / funkce.py
Last active February 18, 2023 20:50
skripticek co jsem udelal kdyz jsem si nebyl jisty jestli jsem slozil spravne funkce
# skripticek na overeni spravnosti slozeni funkci
# autor: vitek kvitek 🌻
# datum: 18.02.2023
# funguje v poho s:
# windows 10
# python 3.10.2
# numpy 1.22.3
# matplotlib 3.7.0
import matplotlib.pyplot as plt