Skip to content

Instantly share code, notes, and snippets.

View alirezaahani's full-sized avatar

Alireza Ahani alirezaahani

View GitHub Profile
@alirezaahani
alirezaahani / main.c
Created May 21, 2023 09:18
Bouncing ball
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
#include <math.h>
#include <string.h>
#include <unistd.h>
#define WIDTH 64
#define HEIGHT 64
@alirezaahani
alirezaahani / os.asm
Created March 4, 2022 14:53
A simple 16bit OS that asks your name and says hello.
MAX_STR_LEN equ 100
org 0x7c00
bits 16
mov ax, 0
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7c00
@alirezaahani
alirezaahani / main.c
Created October 27, 2021 08:06
Multithreaded prime check in C ( using pthread )
#include <stdio.h>
#include <pthread.h>
#include <stdbool.h>
#include <pthread.h>
#define MAX_THREADS 64
#define MAX_PRIMES 1000
struct thread_info
{
@alirezaahani
alirezaahani / main.py
Created October 7, 2021 10:21
Small notes program
notes = []
with open('Notes.txt', 'r') as f:
for i, l in enumerate(f):
l = l.strip()
print(i, l)
notes.append([l[:-4], l[-2] == 'X'])
while True:
try:
@alirezaahani
alirezaahani / fault.asm
Created June 25, 2021 09:06
small seg fault
section .text
global _start
_start:
mov byte[0x0], 0x1
@alirezaahani
alirezaahani / main.rs
Last active May 21, 2023 09:13
Digital product
/*
Digital product - counts how many steps takes to multiply digits of number and get to 1 digits.
123:
1*2*3 => 6
=> 1 Step(s)
*/
fn multiplie_digits(n: u32) -> u32
@alirezaahani
alirezaahani / main.py
Created April 23, 2021 11:47
incompelete tasks courses.aut.ac.ir
import requests
from bs4 import BeautifulSoup as bs
from time import sleep
from math import ceil
username = input("Username:")
password = input("Password:")
with requests.session() as session:
res = session.get("https://courses.aut.ac.ir/login/")
#!/bin/python3
from PIL import Image
import sys
image_src = sys.argv[1]
with Image.open(image_src) as img:
h,w = img.size
with open('main.html','w+') as fhand:
fhand.write("""
@alirezaahani
alirezaahani / autoclicker.sh
Created June 29, 2020 08:55
Bash autoclicker
while [ 1 ]
do
xdotool click 1
sleep 5
done