Skip to content

Instantly share code, notes, and snippets.

View misgeatgit's full-sized avatar
🎯

Misgana Bayetta misgeatgit

🎯
  • opencog
  • HongKong
View GitHub Profile
@misgeatgit
misgeatgit / cmp_slot_noslot.py
Last active December 26, 2022 14:19
Performance comparison of slotted vs non-slotted class in python3.11. Based on https://www.youtube.com/watch?v=Fot3_9eDmOs.
#!/usr/bin/python3.11
from typing import Union
from functools import partial
import timeit
class Foo:
__slots__ = "name", "age"
def __init__(self, name : str, age : int) -> None:
self.name = name
@misgeatgit
misgeatgit / send_email_with_attachments.py
Created February 11, 2022 06:35
Demonstration of how to send email with different types of attachments
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
def send_test_mail(body):
sender_email = "misgana.bayetta@gmail.com"
receiver_email = "misgana.oss@gmail.com"
mport json
import urllib
people = ["Misgana", "Rahel", "Yosef", "Nemera", "Hawi", "Bayetta", "Fantaye", "Kemeru", "Ayantu", "Ayelech"]
generated = [False]*len(people)
random_number_service_url = f"https://qrng.anu.edu.au/API/jsonI.php?length={len(people)}&type=uint16"
names_generated = []
while not all(generated):
request = urllib.request.urlopen(random_number_service_url)
data = json.load(request)
from bokeh.plotting import figure
from bokeh.models import ColumnDataSource, HoverTool
from bokeh.plotting import figure, output_file, show
def location_plot(title, colors):
whisky_csv = "whiskies.csv"
whisky = pd.read_csv(whisky_csv)
output_file(title+".html")
location_source = ColumnDataSource(
data = {
@misgeatgit
misgeatgit / libevent-v-libuv.md
Created November 26, 2021 01:07 — forked from eddieh/libevent-v-libuv.md
libevent vs libuv

libevent vs libuv

Comparing libevent and libuv. My upfront biased: I want to like libevent. However, I want to objectively compare the two and make an informed decision.

What versions are we comparing?

  • libevent 2.0.22 (Stable) [2014-01-05]
  • libuv 1.8.0 (Stable) [2015-12-15]
import React from 'react';
import {
AsyncStorage,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
import json
import time
from websocket import create_connection
#NOTE: needs installation of pytest and pytest-benchamark libraries
sentences = ['How do you treat a migraine?']
uri = "ws://{}:{}{}".format('node1.naint.tech', 8383, '/services/bio_clinical_bert/')
ws = create_connection(uri)
import pandas as pds
import numpy as np
import ffx
# Silence SKlearn warning on python3
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
import pandas as pds
import numpy as np
import ffx
# Silence SKlearn warning on python3
def warn(*args, **kwargs):
pass
import warnings
warnings.warn = warn
2018-12-28 01:08:18.088603 887620
2018-12-28 01:13:21.270092 887889
2018-12-28 01:18:31.658331 888220
2018-12-28 01:23:34.410043 889230
2018-12-28 01:28:37.181794 889680
2018-12-28 01:33:48.209001 890040
2018-12-28 01:38:51.388811 890925
2018-12-28 01:43:54.706751 891480
2018-12-28 01:48:57.160848 891730
2018-12-28 01:54:03.030119 892121