Skip to content

Instantly share code, notes, and snippets.

@mdukat
mdukat / pokemon.json
Created October 16, 2023 23:46
pokemon.json
[{"pokemonName": "Bulbasaur", "pokemonTypes": ["Grass", "Poison"], "pokemonPokedexID": "0001", "pokemonTotal": "318", "pokemonHP": "45", "pokemonAttack": "49", "pokemonDefense": "49", "pokemonSpecialAttack": "65", "pokemonSpecialDefense": "65", "pokemonSpeed": "45", "pokemonIconLink": "https://img.pokemondb.net/sprites/sword-shield/icon/bulbasaur.png"}, {"pokemonName": "Ivysaur", "pokemonTypes": ["Grass", "Poison"], "pokemonPokedexID": "0002", "pokemonTotal": "405", "pokemonHP": "60", "pokemonAttack": "62", "pokemonDefense": "63", "pokemonSpecialAttack": "80", "pokemonSpecialDefense": "80", "pokemonSpeed": "60", "pokemonIconLink": "https://img.pokemondb.net/sprites/sword-shield/icon/ivysaur.png"}, {"pokemonName": "Venusaur", "pokemonTypes": ["Grass", "Poison"], "pokemonPokedexID": "0003", "pokemonTotal": "525", "pokemonHP": "80", "pokemonAttack": "82", "pokemonDefense": "83", "pokemonSpecialAttack": "100", "pokemonSpecialDefense": "100", "pokemonSpeed": "80", "pokemonIconLink": "https://img.pokemondb.net/spri
@mdukat
mdukat / main.py
Created September 25, 2023 01:21
Multithreading sqlite3 INSERT with Lock() example I made at 3am
import threading
import sqlite3
def threadfunc(name, con, lock):
print(name)
with lock:
with con:
con.execute("INSERT INTO test VALUES (?)", (name,))
if __name__ == "__main__":
lock = threading.Lock()
@mdukat
mdukat / .bashrc
Created September 4, 2023 01:25
Git alias, to create local release tar
alias git-release='git status >/dev/null && TARNAME=$(basename $(pwd))-$(git branch --show-current)-$(git rev-parse --short HEAD).tar && tar cf ${TARNAME} $(git ls-tree -r HEAD --name-only | tr "\n" " ") && echo "${TARNAME}"'
@mdukat
mdukat / build-tmux-without-root.sh
Last active March 26, 2022 18:58
Build and install tmux on linux as standard user
#!/bin/bash
# Mateusz Dukat 26.03.2022
wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
wget https://invisible-mirror.net/archives/ncurses/current/ncurses-6.3-20220319.tgz
wget https://github.com/tmux/tmux/releases/download/3.2a/tmux-3.2a.tar.gz
tar xvf libevent-2.1.11-stable.tar.gz
tar xvf ncurses-6.3-20220319.tgz
@mdukat
mdukat / preplace.cpp
Last active September 13, 2023 20:03
Python-like string replace method for C++
#include <iostream>
#include <string>
int preplace(std::string& input, const std::string& a, const std::string& b){
size_t index;
int n = 0;
while((index = input.find(a,0)) != std::string::npos){
input.replace(index, a.size(), b);
n++;
}
@mdukat
mdukat / test.sh
Created December 2, 2021 12:17
Check size of ubuntu repo pool for amd64 only
rsync -a --progress --prune-empty-dirs --include "*/" --include "*_all.deb" --include "*_amd64.deb" --include "*.dsc" --exclude "*" --dry-run --stats rsync://pl.archive.ubuntu.com/ubuntu/pool/universe /home/m/repo-test/pool
@mdukat
mdukat / zajecia8.java
Created November 7, 2021 11:49
zadanie 8
// Zadanie 8
{
System.out.println("Zadanie 8\n");
byte[][] tab = new byte[5][5];
for(int i = 0; i<5; i++){
for(int j = 0; j<5; j++){
tab[i][j] = (byte)((Math.random() * (125-0)) + 0);
}
}
@mdukat
mdukat / gitweb.css
Created May 13, 2021 01:16
Modified black gitweb.css
body {
font-family: sans-serif;
font-size: small;
border: solid #26272e;
border-width: 1px;
margin: 10px;
background-color: #000000;
color: #ffffff;
}
@mdukat
mdukat / aes-how-to.c
Created November 24, 2020 11:24
Quick aes reference
// Based on https://github.com/clarus/phd-experiments/blob/master/embedded-compcert/test/c/aes.c
// For quick reference
// rijndael-alg-fst.{h,c} source:
// https://fastcrypto.org/vmac/rijndael-alg-fst.c
// https://fastcrypto.org/vmac/rijndael-alg-fst.h
// build with:
// gcc main.c rijndael-alg-fst.c
#include <SPI.h>
/*
* DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.