Skip to content

Instantly share code, notes, and snippets.

View timurbakibayev's full-sized avatar

Timur Bakibayev timurbakibayev

  • Neckarwiese
  • Almaty, Kazakhstan
View GitHub Profile
@timurbakibayev
timurbakibayev / bycicle.py
Last active May 21, 2020 10:18
Animated bicycle using Pillow library
import math
from PIL import Image, ImageDraw
images = []
zoom = 0.5
width = int(860 * zoom)
height = int(630 * zoom)
def draw_frame(draw):
from PIL import Image, ImageDraw
images = []
a = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0 ,0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0 ,0, 0, 0, 1, 0, 1, 1, 1, 1],
[1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0 ,0, 0, 0, 1, 0, 0, 0, 0, 0],
oracle = [
{"context": "", "question": "hello", "answer": "Hi!", "new_context": ""},
{"context": "", "question": "life", "answer": "Yes, we have a life insurance!", "new_context": "life"},
{"context": "", "question": "car", "answer": "Yes, we have an auto insurance!", "new_context": "car"},
{"context": "", "question": "auto", "answer": "Yes, we have an auto insurance!", "new_context": "car"},
{"context": "", "question": "vehicle", "answer": "Yes, we have an auto insurance!", "new_context": "car"},
{"context": "", "question": "accident", "answer": "Oh, we are sorry! Is anyone injured?", "new_context": "accident_injured?"},
{"context": "accident_injured?", "question": "yes", "answer": "Call 112! This is serious!", "new_context": "accident"},
{"context": "accident_injured?", "question": "no", "answer": "Please give us the address...", "new_context": "accident_address"},
from PIL import Image, ImageDraw
import random
import math
images = []
w, h = 500, 300
class Particle:
_x = 0
_y = 0
x = 0
@timurbakibayev
timurbakibayev / tetris.py
Last active May 31, 2024 12:57
Tetris game in Python
import pygame
import random
colors = [
(0, 0, 0),
(120, 37, 179),
(100, 179, 179),
(80, 34, 22),
(80, 134, 22),
(180, 34, 22),
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Alpha Substitution Cipher</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
</head>
<body style="margin: auto;">
<div style="padding: 2em; max-width: 800px; align-self: center">
<form>
@timurbakibayev
timurbakibayev / matrices.cpp
Created November 5, 2020 15:04
Matrix Multiplication in C++
#include <iostream>
int main(int argc, const char * argv[]) {
int n = 800;
int a[n][n], b[n][n], mult[n][n], i, j, k;
for(i = 0; i < n; ++i)
for(j = 0; j < n; ++j)
a[i][j] = 1;
@timurbakibayev
timurbakibayev / matrices.py
Created November 5, 2020 15:06
Matrix Multiplication in Python
n = 300
a = np.ones((n,n))
b = np.ones((n,n))
c = np.zeros((n,n))
start_time = time.time()
for i in range(n):
for j in range(n):
for k in range(n):
c[i][j] += a[i][k] * b[k][j]
@timurbakibayev
timurbakibayev / matrices_numpy.py
Created November 5, 2020 15:11
Matrices Multiplication with Numpy
n = 1000
a = np.ones((n,n))
b = np.ones((n,n))
start_time = time.time()
c = a.dot(b)
print(f"I did it in {time.time() - start_time} sec.")
import pygame
pygame.init()
screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption("Heli")
done = False
clock = pygame.time.Clock()
# LOAD Images Here!
# Initialize some variables
while not done:
# GAME UPDATE