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
from selenium import webdriver
import urllib.request
import time
class Finder:
def __init__(self, url):
self.driver = webdriver.Chrome() # this could be editable but whatever
self.driver.get(url)
def find(self, id):
from inputs import get_gamepad
import pygame
import time
def scale(dimension, coordinate, gamepad_max):
scaled = coordinate * dimension // (gamepad_max * 2) + dimension // 2
return scaled if scaled > 0 else 0
def display_text(text, screen, pos, font, color):
screen.blit(font.render(text, True, color), pos)
@aflaag
aflaag / bit.rs
Last active August 28, 2021 13:45
finally i managed to do this
use std::{fmt, marker::PhantomData};
#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
pub enum Value {
Zero,
One,
BitNumber,
}
impl fmt::Display for Value {
@aflaag
aflaag / hw4req.py
Last active November 20, 2021 19:58
import math
import pronouncing
def evaluate_partial_precedence(A, B, tau, mA, mB):
c = i = j = 0
while i < mA and j < mB:
curr_A = A[i]
curr_B = B[j]
@aflaag
aflaag / hw6.py
Last active March 21, 2024 09:22
import images
def ex(file_dati, file_png, spaziatura):
dimensions = data(file_dati)
biggest = tuple(map(lambda line: (sum(map(lambda building: building[0], line)) + spaziatura * (len(line) + 1), max(map(lambda building: building[1], line))), dimensions))
w = max(map(lambda t: t[0], biggest))
h = spaziatura * (len(dimensions) + 1) + sum(map(lambda t: t[1], biggest))
black_stripe = [(0, 0, 0)] * w
picture = list(map(lambda _: black_stripe.copy(), range(h)))
curr_y = spaziatura
center_x = w >> 1
@aflaag
aflaag / hw8.py
Last active March 21, 2024 09:22
def ex(colors, D, img_properties):
if img_properties == "pattern_diff_":
images = []
pattern_diff(set(colors), D, [[]], images, (-1,), tuple(), 0, 0)
if D == 1:
return []
return list(map(lambda image: tuple(map(tuple, image)), images))
else:
mkdir -p $1
mv $1.sv $1
cd $1
echo "read -sv $1.sv
hierarchy -top $1
proc; opt; techmap; opt
write_json $1.js" > $1.ys
@aflaag
aflaag / rt.py
Last active February 18, 2022 20:16
from math import sqrt as Z;print("\n".join(map(lambda t:"".join(t[1])if t[0]!=4 else"".join(t[1][:24])+"".join(map(lambda x:chr(ord(x)-3),"ud|#wudfhg#dvfll/#e|#skdqwdvp#?6"))+"".join(t[1][-24:]),enumerate([[" .\'`^\",:;Il!i><~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$"[int((0.299*B(I[1][0])+0.587*B(I[1][1])+0.114*B(I[1][2]))*sum([k[0]*(n if(n:=sum([x*y for x,y in zip(N,L)]))>0 else 0)/Z(sum([x*x for x in N])*sum([x*x for x in L]))for k in[(0.6,(2,1,0),0),(0.2,(1,4,4),1)]if(L:=k[1]if k[2]else(k[1][0]-X*T,k[1][1]-Y*T,k[1][2]-T))!=[]and(S:=X*T-I[0][0])!=[]and(R:=Y*T-I[0][1])!=[]and(Q:=T-I[0][2])!=[]and(E:=Z(S*S+R*R+Q*Q))!=[]and(N:=(S/E,R/E,Q/E))!=[]],0.2)/3.64)]if I else" "for W in range(80)if(H:=1<<32)and(T:=H)and not(I:=None)and(X:=W/80-0.5)!=[]and(Y:=0.5-J/30)!=[]and(j:=min([(M,t)if(a:=2*(X*X+Y*Y+1))!=[]and(b:=2*(-M[0][0]*X-M[0][1]*Y-M[0][2]))!=[]and(A:=b*b-2*a*(sum([x*x for x in M[0]])-M[2]*M[2]))>0 and(U:=(-b-Z(A))/a)!=[]and(V:=(Z(A)-b)/a)!=[]and(t:=min(H if U<0 else U,H if V<0 else V))<T else(
.globl main
.data
DNA1:
.asciiz "GAGCCTACTAACGGGAT"
DNA2:
.asciiz "CATCGTAATGACGGCCT"
.text
main:
.globl main
.data
N: .word 6
M: .word 6
line0: .word 1, 2, 3, 4, 5, 6
line1: .word 1, 2, 3, 4, 5, 6
line2: .word 1, 2, 3, 4, 5, 6
line3: .word 6, 5, 4, 3, 2, 1
line4: .word 6, 5, 4, 3, 2, 1