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
<!-- Cal inline embed code begins -->
<div style="width:100%;height:100%;overflow:scroll" id="my-cal-inline"></div>
<script type="text/javascript">
(function (C, A, L) { let p = function (a, ar) { a.q.push(ar); }; let d = C.document; C.Cal = C.Cal || function () { let cal = C.Cal; let ar = arguments; if (!cal.loaded) { cal.ns = {}; cal.q = cal.q || []; d.head.appendChild(d.createElement("script")).src = A; cal.loaded = true; } if (ar[0] === L) { const api = function () { p(api, arguments); }; const namespace = ar[1]; api.q = api.q || []; typeof namespace === "string" ? (cal.ns[namespace] = api) && p(api, ar) : p(cal, ar); return; } p(cal, ar); }; })(window, "https://app.cal.com/embed/embed.js", "init");
Cal("init", "just-chat", {origin:"https://cal.com"});
Cal.ns["just-chat"]("inline", {
elementOrSelector:"#my-cal-inline",
calLink: "leima/just-chat",
layout: "month_view"
@emptymalei
emptymalei / pyspark-strange-udf-behavior.ipynb
Last active April 20, 2022 15:15
Beware of python mutable objects in pyspark
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@emptymalei
emptymalei / lollipop_plotly.py
Created January 18, 2022 16:19 — forked from caiotaniguchi/lollipop_plotly.py
Plotting Lollipop Charts with Plotly
import numpy as np
import plotly.offline as pyo
import plotly.graph_objs as go
# Generate a random signal
np.random.seed(42)
random_signal = np.random.normal(size=100)
# Offset the line length by the marker size to avoid overlapping
marker_offset = 0.04
@emptymalei
emptymalei / data.py
Created January 16, 2022 08:48
stemgnn_experiment
import torch
from torch.utils.data import Dataset
class FakeTimeSeriesDataset(Dataset):
def __init__(self, sequence_length, input_length, prediction_length, nodes) -> None:
super().__init__()
self.sequence_length = sequence_length
self.prediction_length = prediction_length
@emptymalei
emptymalei / ci.yml
Created November 15, 2021 14:14 — forked from epicfaace/ci.yml
encrypting an entire github pages (mkdocs) website with staticrypt - replace MY_PASSWORD and "YOUR SITE NAME HERE"
name: Docs
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: Build docs
@emptymalei
emptymalei / fetch_data.py
Created August 27, 2021 11:10
Proper HTTP Methods in Python for Data Hoarders
import json
import os
import random
import requests
from loguru import logger
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
@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