Skip to content

Instantly share code, notes, and snippets.

View EteimZ's full-sized avatar

Youdiowei Eteimorde EteimZ

View GitHub Profile
@EteimZ
EteimZ / index-jsx.html
Created December 16, 2022 10:18
Setting up react for use via CDN
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>React-cdn</title>
</head>
<body>
<div id="like-button-root"></div>
@EteimZ
EteimZ / broadcast.py
Last active December 15, 2022 09:14
Simple example of using websocket with vue.
import asyncio
import datetime
import random
import websockets
"""
Server implementation with broadcast functionality
"""
#websocket connections
@EteimZ
EteimZ / babylonian_method.py
Created December 6, 2022 16:26
The babylonian method used to calculate the square root of a number
# Number to calculate its square root
n = 25
# Initial guess
x0 = (n + 1)/2
# maximum number of iterations
max_iter = 30
# Difference threshold
@EteimZ
EteimZ / SOE.py
Last active December 6, 2022 15:28
The Sieve of Erathosthenes is an algorithm used to calculate prime number to a certain range
# maximum range
n = 100
# prime numbers
primes = []
numbers = list(range(2, n+1))
while numbers:
@EteimZ
EteimZ / vdom.html
Last active December 6, 2022 15:17
A simple implementation of the vdom
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample VDOM</title>
</head>
<body>
<div id="root"></div>
@EteimZ
EteimZ / iris.data
Last active November 5, 2022 09:28
Gist demonstrating how to load data from a csv to a database. Then load the data back into a pandas dataframe.
sepal_length,sepal_width,petal_length,petal_width,class
5.1,3.5,1.4,0.2,Iris-setosa
4.9,3.0,1.4,0.2,Iris-setosa
4.7,3.2,1.3,0.2,Iris-setosa
4.6,3.1,1.5,0.2,Iris-setosa
5.0,3.6,1.4,0.2,Iris-setosa
5.4,3.9,1.7,0.4,Iris-setosa
4.6,3.4,1.4,0.3,Iris-setosa
5.0,3.4,1.5,0.2,Iris-setosa
4.4,2.9,1.4,0.2,Iris-setosa
@EteimZ
EteimZ / sqlite_intro.py
Last active November 1, 2022 18:00
Introduction to the sqlite db in python
import sqlite3 # import the sqlite3 library
con = sqlite3.connect("main.db") # connect to database
cur = con.cursor() # create a db cursor
cur.execute("CREATE TABLE person(fullname, lastname, gender, age)") # create a table with the cursor
cur.execute("""
INSERT INTO person VALUES
('John', 'Doe', 'MALE', 20 ),
@EteimZ
EteimZ / animating_sine_wave.ipynb
Created October 25, 2022 15:26
Animating a sine wave with matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EteimZ
EteimZ / vector_class.ipynb
Created October 23, 2022 10:40
Demonstrating OOP in python by creating a vector class.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EteimZ
EteimZ / tuples.ipynb
Last active October 21, 2022 16:04
A brief outline on python's tuples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.