Skip to content

Instantly share code, notes, and snippets.

View tk42's full-sized avatar
💭
changed from @jimako1989

tk42 tk42

💭
changed from @jimako1989
View GitHub Profile
@tk42
tk42 / Fitting_data_with_python.ipynb
Last active August 29, 2015 14:09
Fitting data with Python の和訳
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tk42
tk42 / EM_algorithm.ipynb
Last active December 20, 2015 15:03
Clustering using the EM algorithm
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tk42
tk42 / dotted_dict.py
Created February 19, 2021 19:50
dotaccess dictionary
class dict2(dict):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.__dict__ = self
@tk42
tk42 / mymap.py
Last active February 19, 2021 20:46
shared memory example with multiprocessing.manager
from multiprocessing import Process, Manager
class MyMap():
def __new__(cls):
self = Manager().dict()
return self
def f(d):
d[1] += '1'
d['2'] += 2
@tk42
tk42 / redis_conn.py
Last active June 24, 2021 03:01
async connection pool class to Redis
import logging
import aioredis
class RedisConn:
_pool = {}
# Singleton
def __new__(cls, *args, **kwargs):
if not hasattr(cls, "_instance"):
@tk42
tk42 / mytype.dhall
Created September 16, 2021 11:48
parameter template in dhall
{
Type = {
key : Text,
},
default = {
key = "default",
}
}
@tk42
tk42 / 1.dhall
Created September 17, 2021 05:02
higher-order-function
λ(n : Natural) -> [ n, n + 1 ]
@tk42
tk42 / App.tsx
Created February 4, 2022 13:33
createAppContainer
import React from 'react';
import AppContainer from './appcontainer';
export default function App() {
return (
<AppContainer />
)
}
@tk42
tk42 / auth.ts
Created May 9, 2022 06:03
Next.js API Routes snippet for connecting to REST API
import { API_URL, ENDPOINT_TOKEN } from '../../components/const';
import type { NextApiRequest, NextApiResponse } from "next";
type Todo = {
userId: number;
id: number;
title: string;
completed: boolean;
};
@tk42
tk42 / flowchart.md
Created May 17, 2022 21:51
Backend flowchart
flowchart TD
    B{Documented entity?}
    B -- Yes --> C[NoSQL]
    C --> D{CRUD?}
    B -- No --> E[RDBMS]
    E --> F{CRUD?}
    D -- Yes --> K[FastAPI + Firestore]
    D -- No ----> H[gRPC + Firestore]
 F -- Yes --&gt; I{Use Python libalies?}