Skip to content

Instantly share code, notes, and snippets.

View hqppyz's full-sized avatar
🐙

Marco Montanari hqppyz

🐙
View GitHub Profile
@hqppyz
hqppyz / regexp.c
Created April 8, 2022 11:09
Simplified Compiled Regex [PoliTo APA Lab4 Es3]
/**
* Lab4 Es3:
* Valutazione di espressioni regolari
* I problemi di ricerca di stringe all’interno di testi e/o collezioni di stringhe (solitamente di
* dimensione maggiore rispetto alla stringa cercata) si basano raramente su un confronto esatto, ma
* molto spesso necessitano di rappresentare in modo compatto non una, ma un insieme di stringhe
* cercate, evitandone per quanto possibile l’enumerazione esplicita.
* Le espressioni regolari sono una notazione molto utilizzata per rappresentare (in modo compatto)
* insiemi di stringhe correlate tra loro (ad esempio aventi una parte comune).
* Una espressione regolare (o regexp) è una sequenza di simboli (quindi una stringa) che identifica
@hqppyz
hqppyz / triggers.sql
Created April 5, 2022 09:43
Triggers (Basi di Dati)
-- Marco Montanari 05/04/2022
-- https://dbdmg.polito.it/wordpress/wp-content/uploads/2020/05/trigger-BD.pdf
-- Inventory (_PartNr_, QtyOnHand, ThresholdQty, ReorderQty)
-- PendingOrders(_PartNr_, OrderDate, OrderedQty)
-- when the stocked quantity of a product goes
-- below a given threshold
-- a new order for the product should be issued
@hqppyz
hqppyz / quicksort.c
Last active March 25, 2022 22:12
QuickSort with Lomuto partition
#include <stdio.h>
/**
* [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
* [ 8, 29, 60, 6, 4, 93, 85, 5, 26, 29, 2, 69, 83, 72, 43, 50]
* Pivot 50 (a[r])
* I 0
* Leftwall 0
*
* Step 1)
@hqppyz
hqppyz / swap.c
Created February 8, 2022 11:52
Soluzioni Hardware con e senza starvation per il corso SisOp
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
/**
* Soluzioni Hardware:
* Swap
*
@hqppyz
hqppyz / milk.c
Created February 7, 2022 18:47
Personal Implementation of Signals using pipes
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
void s_init(int **S, int k);
void s_destroy(int *S);
void s_wait(int *S);
@hqppyz
hqppyz / pixelgenocide.conf
Last active April 6, 2020 17:36
PixelGenocide default config
# You can find more info at https://github.com/happyzleaf/PixelGenocide/wiki/Configuration#broadcast
broadcast {
# Placeholders: %wiped%. Leave empty to disable.
cleaned="&a%wiped% pokémon have been wiped away."
# Placeholders: %timer_seconds% %timer_human%. Leave empty to disable.
timer="&4Useless pokémon will be wiped away in &c%timer_human%&4."
}
# You can find more info at https://github.com/happyzleaf/PixelGenocide/wiki/Configuration#conditions
conditions {
blacklist {
@hqppyz
hqppyz / README.md
Last active July 2, 2020 14:55
Polito Video Clipboard

English

This addon lets you copy entire courses from PoliTO's website to your clipboard. You can then paste the content to JDownloader 2 to download each and every desired video. To install this script, download Greasemonkey or Tampermonkey (depending on your browser), then, click here and follow the GUI. Once installed, you can browse any video-lesson and copy the entire course in a single click.

Italiano

@hqppyz
hqppyz / build.gradle
Created December 11, 2018 11:00
Forge Mixins
buildscript {
repositories {
jcenter()
maven {
name = 'forge'
url = 'https://files.minecraftforge.net/maven'
}
maven {
url = 'http://repo.spongepowered.org/maven'
@hqppyz
hqppyz / ModsScanner.java
Last active August 3, 2023 20:29
Dynamically finding and loading a mod
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.relauncher.CoreModManager;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.FileInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
/**