Skip to content

Instantly share code, notes, and snippets.

View aflaag's full-sized avatar
💭
coding

Alessio Bandiera aflaag

💭
coding
  • Sapienza University of Rome
  • Italy
View GitHub Profile
@aflaag
aflaag / test.hs
Last active March 12, 2024 09:11
import Data.Char (toLower)
import Data.List (sort)
isAlpha c = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
lower = map (\w -> toLower w)
count t = length . filter (== t)
removeDups [] = []
{pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
nativeBuildInputs = with pkgs.buildPackages; [
(texlive.combine {inherit (texlive) scheme-basic latexmk xcolor eurosym titlesec blindtext listings footmisc mdframed etoolbox zref needspace pgf parskip enumitem csquotes float bbm bbm-macros tcolorbox environ varwidth biblatex esint nicematrix stmaryrd mathtools extarrows jknapltx pgfplots multirow algorithm2e ifoddpage relsize karnaugh-map xstring circuitikz ulem tikzfill pdfcol cleveref collection-fontsrecommended algpseudocodex algorithmicx fifo-stack tabto-ltx totcount tikzmark pdftex esint-type1;})
];
}

Informatica 2.0

I anno

I semestre

  • Analisi I [9 cfu]
  • Fondamenti di Programmazione I [6 cfu]
  • Architetture I [6 cfu]
  • Metodi Matematici per l'Informatica [6 cfu]
#!/usr/bin/sh
du -h $1 2>/dev/null | grep '^[0-9]*,*[0-9]*G' | sort -t ' ' -k 1 -n
@aflaag
aflaag / tree.c
Last active April 21, 2023 14:53
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>
#include <stdint.h>
typedef struct {
char* path;
struct Directory** sub_dirs;
} Directory;
@aflaag
aflaag / es6.c
Last active April 16, 2023 09:09
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Clones the available portion of the first block into the second one */
int clone_block(char* m1, char* m2, const int size_m1, const int size_m2) {
int size = size_m1 <= size_m2 ? size_m1 : size_m2;
memcpy(m2, m1, size * sizeof(char));
det ← {∧/1≠⍴⍵:-⌿((~l)(⌿⍤1 2)⍵/⍨~r)×(∇⍤2)(l←∘.≠⍨⍳≢⍵)(⌿⍤1 2)⍵/⍨r←0,1/⍨¯1+≢⍵⋄⍵}
@aflaag
aflaag / hw8.py
Last active December 17, 2022 19:10
def find_neighbours_opponent(board, x, y, w, h, opponent):
neighbours = set()
up, down, left, right = y > 0, y < h - 1, x > 0, x < w - 1
checks = {
(0, 0): False,
(0, -1): up,
(+1, -1): up and right,
(+1, 0): right,
print(sum(((t[0]<=t[2]and t[1]>=t[3])or(t[0]>=t[2]and t[1]<=t[3]))for l in open("a").read().split()if(o:=l.split(","))!=[""]and(t:=list(map(int,o[0].split("-")+o[1].split("-"))))))
@aflaag
aflaag / hw4.py
Last active November 13, 2022 21:07
def get_words(first_filename):
strings = open(first_filename).read().split()
curr_filename, words = strings.pop(0), strings
while first_filename != curr_filename:
strings = open(curr_filename).read().split()
curr_filename = strings.pop(0)
words.extend(strings)