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 / double-integral.py
Last active December 13, 2024 05:38
calculate a dobule integral using naive approach
#
# calculate a dobule integral using naive approach
# python 3.13.0
#
# analytical solution of the example below is -7
# step 0.0100: -6.9976327434199135 (44 ms)
# step 0.0010: -7.000145573771798 (2.7 s)
# step 0.0001: -7.000002405139909 (4 m 49 s)
#
# possible improvements
@okurka12
okurka12 / suppress-openssl-leaks.md
Created October 22, 2024 04:12
Suppress OpenSSL leaks in valgrind

Suppress leaks from OpenSSL in Valgrind

  1. create a supressions file openssl.supp

  2. run valgrind with the suppressions file valgrind --suppressions=openssl.supp

Suppressions file

{
#!/bin/bash
#
# originally from ima2-sbirka repo
#
# brief:
# ------
#
# A script to convert a single svg file to pdf
# Usage: ./svg2pdf SVGFILE
@okurka12
okurka12 / bash-to-fish.sh
Created July 24, 2024 10:58
imports aliases from .bash_aliases to config.fish as abbreviations
#!/bin/bash
#
# imports aliases from .bash_aliases to config.fish as abbreviations
#
FISHCFG=~/.config/fish/config.fish
BASH_ALIASES=~/.bash_aliases
echo "" >> $FISHCFG
set autoindent
set guidestripe 80
#
# for fish shell:
# .. put it into ~/.config/fish/config.fish
# .. tested with fish 3.7.1
#
# cd's into a directory and creates it if it doesn't
# exist yet
#
# USAGE: cdd DIR
#
@okurka12
okurka12 / utils.sh
Created June 9, 2024 10:25
utilities for POSIX shell
# ask if something is ok, exit if it's not
# if OPTION_Y variable is "-y", do nothing
prompt_confirm () {
if [ "$OPTION_Y" != "-y" ]; then
printf "%s (y/n) " "$*"
read -r PROCEED
if [ "$PROCEED" != "y" ]; then
echo "abort"
exit
fi
@okurka12
okurka12 / customize-bash.sh
Last active July 12, 2025 03:35
retrieve & update my .bashrc or .bash_aliases
#!/bin/sh
# WARNING
# replaced by https://github.com/okurka12/dotfiles/blob/main/install-bash.sh
# one-liner
# curl https://gist.githubusercontent.com/okurka12/f00b18199ac17154e50ecad6866b3bd2/raw > deleteme.sh && chmod +x deleteme.sh && ./deleteme.sh aliases && rm -v deleteme.sh
ALIASES_URL=https://gist.githubusercontent.com/okurka12/cc3769db8e6f57dfdf091428095b7e00/raw
@okurka12
okurka12 / cdd.sh
Last active July 12, 2025 03:36
a bash function to mkdir & cd
#
# a bash function to mkdir and cd
# add to the end of .bashrc
#
# author: vit pavlik
# part of https://github.com/okurka12/dotfiles
#
# command to change directory to a directory that doesnt exist yet
cdd () {
@okurka12
okurka12 / asciify_czech.py
Last active July 21, 2024 01:07
Replaces letters with diacritics in a czech text
#
# Prints stdin input without diacritics.
# Expects a text in czech language.
#
# Author: okurka12
#
# Date: 2024-07-21
#
# reads from stdin and outputs on stdout
#