Skip to content

Instantly share code, notes, and snippets.

View wiseaidev's full-sized avatar
🦀
Rusting!

Mahmoud wiseaidev

🦀
Rusting!
View GitHub Profile
@wiseaidev
wiseaidev / install_ipc_proxy_kernel.py
Last active June 16, 2024 08:33 — forked from SpencerPark/install_ipc_proxy_kernel.py
A little proxy kernel (and installer) that manages a wrapped kernel connected with tcp. It was designed to support the case where the server starts kernels with ipc transport but only tcp is supported (like Rust).
import argparse
import json
import os
import os.path
import shutil
import sys
from jupyter_client.kernelspec import (KernelSpec, KernelSpecManager,
NoSuchKernel)
@wiseaidev
wiseaidev / fastapi_reverse_tree.py
Created March 12, 2023 09:16
A simple FastAPI endpoint takes a binary tree and reverses it.
from fastapi import FastAPI
from typing import List, Optional
from pydantic import BaseModel
app = FastAPI()
class Node(BaseModel):
value: Optional[int]
left: Optional["Node"] = None
@wiseaidev
wiseaidev / jwt_auth_bearer.py
Created March 12, 2023 08:52
A simple script to to change default fastapi JWT Auth schema.
from fastapi import (
FastAPI,
)
from fastapi.openapi.utils import (
get_openapi,
)
from typing import (
Any,
)
app = FastAPI(
@wiseaidev
wiseaidev / alien_translator.py
Last active March 12, 2023 08:45
A simple fastapi endpoint that allows users to translate text into the language of aliens, but with the added twist that the translations are based on the language of an extraterrestrial species. it also supports for input text in other languages by using a language detection `langdetect`, and supports for audio translation.
from fastapi import FastAPI
from langdetect import detect
from gtts import gTTS
app = FastAPI()
translations = {
"Vortian": {
"A": "Z",
"B": "Y",
102
1755
2075
6543
12548
496080199
0age
0mkara
0x5e5e
0xKiwi

Keybase proof

I hereby claim:

  • I am wiseaidev on github.
  • I am wiseai (https://keybase.io/wiseai) on keybase.
  • I have a public key whose fingerprint is 6C63 E3A7 C1B9 E36D F2DE 91C9 FC86 41B7 1E19 147B

To claim this, I am signing this object:

@wiseaidev
wiseaidev / binary_search.py
Created June 3, 2022 18:36
Recursive and iterative versions of the binary search algorithm.
from typing import Union, TypeVar
E = TypeVar("E", bound=Union[int, float])
def recursive_binary_search(array: list[E], left: E, right: E, target: E) -> int:
if array != sorted(array):
array.sort()
if left is None:
left = 0
@wiseaidev
wiseaidev / merge_lists.py
Created June 2, 2022 15:51
Different methods to merge two lists.
import random
import itertools
import operator
import functools
import collections
def extend(list1_list2):
list1, list2 = list1_list2
merged_list = []
merged_list.extend(list1)
@wiseaidev
wiseaidev / sleep_sort.py
Last active June 1, 2022 18:38
A pythonic implementation of the sleep sort algorithm.
from concurrent.futures import ThreadPoolExecutor
from time import sleep
from typing import List, Union
def sleep_sort(input_list: List[Union[int, float]]) -> List[Union[int, float]]:
sorted_list: List[Union[int, float]] = []
def inner(item: Union[int, float], sorted_list: List[Union[int, float]]) -> None:
sleep(item)
sorted_list.append(item)
''' usage :
python3 Server.py
'''
import numpy as np
import cv2
# Import the socket library
import socket
import pickle
import struct
from Recognize import *