- Analisi I [9 cfu]
- Fondamenti di Programmazione I [6 cfu]
- Architetture I [6 cfu]
- Metodi Matematici per l'Informatica [6 cfu]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [] = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{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;}) | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
du -h $1 2>/dev/null | grep '^[0-9]*,*[0-9]*G' | sort -t ' ' -k 1 -n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <dirent.h> | |
#include <string.h> | |
#include <stdint.h> | |
typedef struct { | |
char* path; | |
struct Directory** sub_dirs; | |
} Directory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
det ← {∧/1≠⍴⍵:-⌿((~l)(⌿⍤1 2)⍵/⍨~r)×(∇⍤2)(l←∘.≠⍨⍳≢⍵)(⌿⍤1 2)⍵/⍨r←0,1/⍨¯1+≢⍵⋄⍵} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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("-")))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
NewerOlder