Skip to content

Instantly share code, notes, and snippets.

@jarekt
jarekt / LUT.c
Created October 15, 2023 10:18
4bit bcd to 7 segment (0x1-0xF)
const char bcd27seg[16] = {
0x3F, 0x06, 0x5b, 0x4f,
0x66, 0x6d, 0x7d, 0x07,
0x7f, 0x67, 0x77, 0x7c,
0x39, 0x5e, 0x79, 0x71}
@jarekt
jarekt / yt shorts block.txt
Last active June 23, 2022 10:40
simple ublock origin filter to block youtube shorts
youtube.com##[aria-label="Shorts"]:upward(#dismissible):upward(1)
||i.ytimg.com/vi/*/hq720_2.jpg*$image
||youtube.com/shorts^$all
@jarekt
jarekt / selectthingy.py
Created February 20, 2022 18:33
create a csv file to be imported into mca selector from coreprotect database
import sqlite3
from contextlib import redirect_stdout
ro_db = lambda a : "file:" + a + "?mode=ro"
db = sqlite3.connect("file:out.db?mode=ro", uri=True)
db.set_trace_callback(print)
c = db.cursor()
@jarekt
jarekt / mergedb.py
Last active April 1, 2022 18:38
This script merges two coreprotect databases.
"""
This script merges two coreprotect databases. It expects databases named '1.db'
and '2.db' and outputs 'out.db' (this can be changed on line 26).
It doesn't merge entity kills, and filters out hopper transactions and pistons,
everything else is merged 100%. It is a little rigid and simple as I wrote it
only for personal use and for use one time only. There is plenty of comments
though, so it should be fairly easy to understand. Feel free to expand on the code
and make it into a real app.
"""
"""
@jarekt
jarekt / usage.css
Last active January 2, 2022 17:48
Fix viewport height size on mobile webkit browsers
* {
min-height: 100vh;
min-height: calc(var(--vh, 1vh) * 100);
}
@jarekt
jarekt / KombinacniCislo.java
Last active November 24, 2020 17:57
binomic coefficient calculator
import java.math.BigInteger;
/**
* KombinacniCislo
*/
public class KombinacniCislo
{
public static void main(String[] args)
{
int n = 0;
@jarekt
jarekt / KvadratickaSranda.java
Last active December 1, 2020 21:16
A simple Quadratic equation solver capable of real number output both in the form of fractions and decimals
/**
* KvadratickaSranda
*/
public class KvadratickaSranda
{
public static void main(String[] args)
{
Fraction a = new Fraction();
Fraction b = new Fraction();
Fraction c = new Fraction();
@jarekt
jarekt / pingplot.py
Last active September 21, 2020 19:55
Simple python script for logging your ping
from ping3 import ping
import matplotlib.pyplot as plt
import datetime
from matplotlib.widgets import Button, TextBox
class Pingplot:
def __init__(self):
self.fig, self.ax = plt.subplots()
@jarekt
jarekt / file2h.py
Created July 25, 2019 15:10
simple script for converting a file into an includable header file (in the form of a const char array) for your c / cpp programs
#this script takes a file and makes it into a c string in a header file
file_name = "tetris.ch8"
newfile_name = "tetris.h"
start_string = '#define LOAD_STRING\nconst char import_string[] = {'
end_string = '};'
oldFile = open(file_name, "rb")
oldFile = oldFile.read()
oldFile = "".join( hex(x) +"," for x in oldFile)
@jarekt
jarekt / GetZipAndExtract.py
Created July 25, 2019 15:05
python script for downloading and extracting zip files from the internet
#simple script for downloading github repos easily
import requests
import zipfile
import os
url = 'https://github.com/jarekt/jlib/archive/master.zip'
folder = 'jlib'
#zip conents into this ^ folder
r = requests.get(url)