Skip to content

Instantly share code, notes, and snippets.

View emptymalei's full-sized avatar
📡
sending EM waves to Mars

LM emptymalei

📡
sending EM waves to Mars
View GitHub Profile
@emptymalei
emptymalei / gan_mnist.py
Last active August 10, 2021 23:10
GAN with MNIST Data
import matplotlib.pyplot as plt
import torch
from pathlib import Path
import torchvision
import torchvision.transforms as transforms
from loguru import logger
from torch import nn
import click
from itertools import combinations
class Graph(object):
"""A graph object
"""
def __init__(self, source_nodes, target_nodes, weights=None):
if not isinstance(source_nodes, list):
@emptymalei
emptymalei / Dockerfile
Last active January 21, 2021 16:44
preload data into redis using python script
# This is an experiment
# It is not working
FROM redis:4.0.2-alpine
RUN apk add --no-cache python3 py3-pip
RUN pip3 install click
RUN pip3 install redis
RUN mkdir app
COPY . /app
@emptymalei
emptymalei / app.py
Last active January 21, 2021 12:26
demonstrate how fastapi and aiohttp can work together to make the API faster
# This script is based on the article:
# https://dev.to/fuadrafid/fastapi-the-good-the-bad-and-the-ugly-20ob
# The task is to gather three subreddit top articles and show them as the return
# If we do this in squential code, this will be much slows than the gather method used here.
from fastapi import FastAPI
import json
import asyncio
import time
import aiohttp
@emptymalei
emptymalei / ecdc covid 19 data
Created December 24, 2020 14:29
audiorepr package demo data
datetime,AT,BE,BG,CY,CZ,DE,DK,EE,ES,FI,FR,GB,GR,HR,HU,IE,IS,IT,LI,LT,LU,LV,MT,NL,NO,PL,PT,RO,SE,SI,SK,Total
2020-03-20,550.0,309.0,13.0,0.0,172.0,5940.0,36.0,9.0,3431.0,31.0,1861.0,647.0,46.0,23.0,12.0,191.0,80.0,5322.0,0.0,15.0,135.0,15.0,5.0,409.0,129.0,68.0,143.0,17.0,122.0,33.0,16.0,19780.0
2020-03-21,453.0,462.0,22.0,9.0,210.0,4185.0,104.0,16.0,2833.0,50.0,1617.0,706.0,31.0,22.0,0.0,126.0,79.0,5986.0,9.0,21.0,139.0,25.0,11.0,534.0,190.0,70.0,235.0,31.0,200.0,22.0,14.0,18412.0
2020-03-22,375.0,558.0,36.0,17.0,91.0,3140.0,71.0,23.0,4946.0,71.0,1847.0,1035.0,35.0,80.0,46.0,102.0,64.0,6557.0,2.0,36.0,186.0,13.0,9.0,637.0,184.0,111.0,260.0,59.0,123.0,42.0,41.0,20797.0
2020-03-23,607.0,586.0,22.0,11.0,170.0,3311.0,69.0,20.0,3646.0,105.0,1559.0,665.0,94.0,29.0,36.0,121.0,95.0,5560.0,10.0,38.0,128.0,15.0,17.0,573.0,206.0,98.0,320.0,66.0,160.0,31.0,7.0,18375.0
2020-03-24,855.0,342.0,16.0,21.0,71.0,4438.0,65.0,26.0,4517.0,74.0,3838.0,967.0,71.0,71.0,20.0,219.0,20.0,4789.0,0.0,36.0,77.0,41.0,17.0,545.0,239.0,115.0,
@emptymalei
emptymalei / some ids
Created June 9, 2020 18:35
some unknow ids
l = """[{type:c,generated:b,id:"Apps:5ced8eb5-a5e3-4150-9ef6-0caf285caed6",typename:a},{type:c,generated:b,id:"Apps:c8ef7e1c-0c91-4030-a71d-8cdc86c367ed",typename:a},{type:c,generated:b,id:"Apps:91339570-731c-45b1-a6f3-4aa93a7e8af0",typename:a},{type:c,generated:b,id:"Apps:266a1a88-b462-4db2-8782-2e9f0980afda",typename:a},{type:c,generated:b,id:"Apps:68324672-4f6a-46d4-9866-4a29e4780d4f",typename:a},{type:c,generated:b,id:"Apps:3eee0834-b7d9-4c9d-b3c0-9eb06aad9efd",typename:a},{type:c,generated:b,id:"Apps:687f039a-8f7a-4ec3-8b21-ea9f7518bc71",typename:a},{type:c,generated:b,id:"Apps:015ceb04-f38c-4746-bb6b-4b149b7b022a",typename:a},{type:c,generated:b,id:"Apps:13a8c28b-dc85-4211-be0d-c02d5ab29933",typename:a},{type:c,generated:b,id:"Apps:9d5bcd49-9621-456b-9ab0-20c519ebc4c6",typename:a},{type:c,generated:b,id:"Apps:f6a5ebd6-7712-41ba-b8fd-d4d8efa840a0",typename:a},{type:c,generated:b,id:"Apps:bc9c079b-daf6-489c-b1c6-0ccb93e0bf80",typename:a},{type:c,generated:b,id:"Apps:941605ec-ef02-4b52-b8d6-3cb792be2b9d",t
in der tat!
@emptymalei
emptymalei / machine.js
Last active March 4, 2020 12:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
lat lon state population
48.53798784334733 9.049518423658956 Baden-Württemberg 10075500
48.94917269695629 11.418027577497131 Bayern 12542000
52.95 13.2 Brandenburg 2500000
52.502299698009296 13.402948501480669 Berlin 3469000
52.765431393186596 9.161108235507873 Niedersachsen 7914000
53.54610462404504 10.024470557873288 Hamburg 1788000
50.60321670836851 9.028805533680368 Hessen 6066000
53.7535394556047 12.549970296944396 Mecklenburg-Vorpommern 1639000
53.19920119721645 8.74885429375113 Bremen 661000
@emptymalei
emptymalei / postal-codes.json
Created February 27, 2020 12:42 — forked from matthewbednarski/postal-codes.json
Global postal codes regex formats
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$" }, { "Note":