Skip to content

Instantly share code, notes, and snippets.

View QuadFlask's full-sized avatar
๐ŸŒด
wanna go vacation

QuadFlask

๐ŸŒด
wanna go vacation
  • Seoul, Korea
View GitHub Profile
@liviaerxin
liviaerxin / README.md
Last active April 3, 2025 02:29
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@charsyam
charsyam / timebased_otpcode_generator.go
Created January 13, 2021 13:54
Go Timebased OTP Code Generator
package main
import (
"crypto/rand"
"crypto/hmac"
"crypto/sha1"
"encoding/base32"
"time"
"fmt"
)
@magicdude4eva
magicdude4eva / zsh-syntax-highlighting paste performance improvement
Last active April 25, 2025 19:23
zsh-syntax-highlighting paste performance improvement
Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
@kitze
kitze / store.js
Created January 24, 2018 13:14
simplified redux
import produce from 'immer';
import {createStore} from 'redux';
const handleActions = (actionsMap, defaultState) => (
state = defaultState,
{type, payload}
) =>
produce(state, draft => {
const action = actionsMap[type];
action && action(draft, payload);
@jooyunghan
jooyunghan / monad-in-java.md
Last active November 17, 2023 04:54
ํ•œ๊ธ€๋ฒˆ์—ญ - Functor and monad examples in plain Java

Functor and monad examples in plain Java

์ด ๊ธ€์€ ์šฐ๋ฆฌ๊ฐ€ ์“ด ์ฑ…, 'Reactive Programming with RxJava' ์˜ ๋ถ€๋ก์ด์—ˆ๋‹ค. Reactive programming๊ณผ ๊ด€๋ จ์ด ๊นŠ์€ ์ฃผ์ œ๊ธด ํ•˜์ง€๋งŒ ๋ชจ๋‚˜๋“œ๋ฅผ ์†Œ๊ฐœํ•œ๋‹ค๋Š” ๊ฒŒ ์ฑ…๊ณผ ์ฉ ์–ด์šธ๋ฆฌ์ง€๋Š” ์•Š์•˜๋‹ค. ๊ทธ๋ž˜์„œ ๋‚˜๋Š” ๋”ฐ๋กœ ๋ธ”๋กœ๊ทธ์— ์˜ฌ๋ฆฌ๊ธฐ๋กœ ํ–ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ๋‹ค๋ฃจ๋Š” ๋ธ”๋กœ๊ทธ์—์„œ *"๋ฐ˜์€ ๋งž๊ณ  ๋ฐ˜์€ ํ‹€๋ฆด ์ง€ ๋ชจ๋ฅด๋Š” ๋‚˜๋งŒ์˜ ๋ชจ๋‚˜๋“œ ์„ค๋ช…"*์ด๋ž€ ๊ฒƒ์ด ์ƒˆ๋กœ์šด *"Hello World"*๋ผ๋Š” ์ ์„ ๋‚˜๋„ ์ž˜ ์•ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด ๊ธ€์€ ํŽ‘ํ„ฐ(functor)์™€ ๋ชจ๋‚˜๋“œ(monad)๋ฅผ ์ž๋ฐ” ์ž๋ฃŒ ๊ตฌ์กฐ์™€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ผ๋Š” ๊ฐ๋„์—์„œ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ์œผ๋ฉฐ, ์ด๋Š” ๊ณต์œ ํ•  ์ •๋„์˜ ๊ฐ€์น˜๋Š” ์žˆ์„๊ฑฐ๋ผ ์ƒ๊ฐํ–ˆ๋‹ค.

@jarretmoses
jarretmoses / React Native Clear Cache
Last active April 23, 2025 11:20
Clearing the Cache of your React Native Project
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.63 - watchman watch-del-all && rm -rf node_modules && npm install && rm -rf /tmp/metro-* && npm run start --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
@bishboria
bishboria / springer-free-maths-books.md
Last active May 10, 2025 04:28
Springer made a bunch of books available for free, these were the direct links
@staltz
staltz / introrx.md
Last active May 15, 2025 06:11
The introduction to Reactive Programming you've been missing
public class CircularProgressDrawable extends Drawable
implements Animatable {
private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator();
private static final int ANGLE_ANIMATOR_DURATION = 2000;
private static final int SWEEP_ANIMATOR_DURATION = 600;
private static final int MIN_SWEEP_ANGLE = 30;
private final RectF fBounds = new RectF();
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"