Skip to content

Instantly share code, notes, and snippets.

import RPi.GPIO as gpio
import time
gpio.setmode(gpio.BOARD)
in_1 = 3
in_2 = 5
in_3 = 7
@meretciel
meretciel / builtin.py
Created November 28, 2020 20:05
toy akka in python
import multiprocessing as mp
import threading
import time
from os import path
from abc import abstractmethod, ABCMeta
import json
import sys
import logging
@meretciel
meretciel / leetcode-1674.cpp
Created November 30, 2020 01:20
leetcode-1674.cpp
class Point {
public:
int coordinate;
int typeId;
Point(int coordinate, int typeId): coordinate(coordinate), typeId(typeId) {}
};
class Solution {
def KL_distance(p, q, bottom=None):
_s = lambda x, d: sum(x, bottom = bottom, data=d)
A = _s(r'`p \cdot log \frac{`p}{`q}', locals())
B = _s(r"`p \cdot log `p", locals())
C = _s(r"`p \cdot log `q", locals())
return expr("`A = `B - `C", data=locals())
Mq = "\mathcal{M}_{q}(t)"
Md = "\mathcal{M}_{d}(t)"
print(KL_distance(p = Mq, q = Md, bottom="t \in V"))
def removeNoisyData(data):
output = {}
for k, v in data.items():
if not k in SNAPSHOT and not hasattr(v, "__call__") and k != "SNAPSHOT":
output[k] = v
return output
def expr(s, data=None):
if data is None:
_data = removeNoisyData(globals())
import os
from os import path
import sys
PROJECT_NAME = "FlaskSetupDemo"
MAIN_SCRIPT = """
from flask import Flask
from flask import render_template
name: learn-github-actions
run-name: ${{ github.actor }} is learning GitHub Actions
on: [push]
env:
ARTIFACT_NAME: GithubActionDemo.${{ github.ref_name }}.${{ github.sha }}.zip
AWS_REGION: us-east-1
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout