Skip to content

Instantly share code, notes, and snippets.

View touatily's full-sized avatar
🏠
Working from home

Lyes Touati touatily

🏠
Working from home
View GitHub Profile
@touatily
touatily / palestine.py
Created March 3, 2024 15:21
Palestine flag in Python
import turtle
import math
import time
def drawTriangle(tur, xy1: tuple, xy2: tuple, xy3: tuple, color:str, fill:str):
tur.up()
tur.color(color, fill)
tur.goto(xy1[0], xy1[1])
tur.begin_fill()
tur.down()
@touatily
touatily / og.py
Last active October 25, 2022 20:48
Olympic games flag
import turtle
import math
def drawCircle(tur, center:tuple, rayon:int, color:str="black", fill:str="white", thickness:int=1):
tur.width(thickness)
tur.up()
tur.color(color, fill)
tur.goto(center[0], center[1] + rayon)
@touatily
touatily / mr_flag.py
Created March 19, 2022 07:59
Morocco Flag
import turtle
import math
def drawRect(tur, xy1: tuple, xy2: tuple, color:str, fill:str):
tur.up()
tur.color(color, fill)
tur.goto(xy1[0], xy1[1])
tur.begin_fill()
tur.down()
@touatily
touatily / usa_flag.py
Created November 28, 2021 12:52
USA Flag
import turtle
import turtle
import math
def drawStar(tur, pos: tuple, size: int, rot: int, color: str):
tur.up()
tur.goto(pos[0], pos[1])
tur.color(color, color)
@touatily
touatily / eu.py
Created November 12, 2021 19:13
Flag of Europe
import turtle
import math
def drawStar(tur, center, rayon, rot, color):
tur.up()
tur.color(color, color)
tur.goto(center[0] + (rayon * math.sin(math.radians(rot))),
center[1] + (rayon * math.cos(math.radians(rot))))
branche = rayon * 2 * math.cos(math.radians(18))
@touatily
touatily / vigenere.c
Created May 2, 2021 09:55
Implemnetation of vignere cipher
#include "vigenere.h"
void vigenereEnc(const char * text, const char * key, char * ciphertext){
unsigned int i, size = strlen(key);
for(i = 0; text[i] != '\0'; i++){
if( (text[i] >= 'a') && (text[i] <= 'z') ){
int rang = (text[i] + key[i % size] - 2 * 'a') % 26;
ciphertext[i] = 'a' + rang;
}
@touatily
touatily / substitution.c
Created April 30, 2021 22:58
Implementation of mono-alphabetic substitution based encryption
#include <stdbool.h>
#include "substitution.h"
void genkey(char * key){
int i;
strncpy(key, "abcdefghijklmnopqrstuvwxyz", 27);
srand(time(NULL));
for(i = 0; i < 100; i++){
int k, l;
k = rand()%26; l = rand()%26;
@touatily
touatily / ceasar.c
Last active December 31, 2021 19:41
#include "ceasar.h"
void caesarEnc(const char * message, short key, char * ciphertext){
unsigned int i = 0;
short rang;
while( message[i] != '\0'){
if( ( message[i] >= 'a') && (message[i] <= 'z') ){
rang = (message[i] - 'a' + key) % 26;
if( rang < 0) rang += 26;
ciphertext[i] = 'a' + rang;
@touatily
touatily / dz_flag.py
Last active February 27, 2021 17:50
Algerian flag
import turtle
turtle.bgcolor("cyan")
t = turtle.Turtle()
t.speed(1)
width = 600
height = 300
t.up()