Skip to content

Instantly share code, notes, and snippets.

View Arnold-git's full-sized avatar
:octocat:
Working from home

Arnold Ighiwiyisi Arnold-git

:octocat:
Working from home
View GitHub Profile
@ddanier
ddanier / fastapi_globals.py
Last active October 26, 2024 15:37
flask.g for FastAPI.
"""
This allows to use global variables inside the FastAPI application using async mode.
# Usage
Just import `g` and then access (set/get) attributes of it:
```python
from your_project.globals import g
@eric-czech
eric-czech / png_to_numpy.py
Last active October 23, 2024 18:43
Convert png image bytes to numpy array
import numpy as np
from io import BytesIO
from PIL import Image
def png_bytes_to_numpy(png):
"""Convert png bytes to numpy array
Example:
>>> fig = go.Figure(go.Scatter(x=[1], y=[1]))
@Kwisses
Kwisses / merge_sort.py
Created November 6, 2017 01:57
MergeSortPython
def merge_sort(array):
if len(array) <= 1:
return array
midpoint = int(len(array) / 2)
left, right = merge_sort(array[:midpoint]), merge_sort(array[midpoint:])
return merge(left, right)
@kylehounslow
kylehounslow / client.py
Last active April 23, 2024 10:58
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@rxaviers
rxaviers / gist:7360908
Last active November 15, 2024 16:55
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue: