Skip to content

Instantly share code, notes, and snippets.

View Yougigun's full-sized avatar
🤔
Thinking of ...

Gary Yougigun

🤔
Thinking of ...
  • Remote/Taiwan
View GitHub Profile
@Yougigun
Yougigun / latency.txt
Created April 22, 2023 14:23 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@Yougigun
Yougigun / System Design.md
Created June 4, 2022 09:34 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
visited = set()
def depth_first_search(graph,node):
if (node in visited): return
visited.add(node)
print(node)
for adjacent_node in graph[node]:
depth_first_search(graph,adjacent_node)
graph = dict()
graph["1"] = ["2","3"]
import React,{useState} from 'react'
import classes from './Promotion.module.css'
import ChineseChessTable from './ChineseChessTable/ChineseChessTable'
const ChineseChess = () => {
const [carPosition, setCarPosition] = useState({x:0,y:0})
const [carInputX, setCarInputX] = useState(0)
const [carInputY, setCarInputY] = useState(0)
import React from 'react'
const ChineseChessTable = ({Size,CarPos}) => {
let tableTD =[]
let table = []
let tdOfCar = []
for (let y = 0;y<=Size.y;y++){
tableTD.push(<td></td>)
}
for (let y = 0;y<=Size.y;y++){
package main
import (
"context"
"fmt"
"runtime"
"time"
)
func main() {
@Yougigun
Yougigun / vscode_setting_for_activate_python_env.json
Created August 14, 2020 12:58
Auto Activate env specific python in terminal of vscode
{
"python.pythonPath": "C:\\Anaconda3\\envs\\kedro-practice\\python.exe",
"python.terminal.activateEnvironment": true,
"python.condaPath":"C:\\Anaconda3\\Scripts\\conda.exe"
}
@Yougigun
Yougigun / vscode_setting_for_activate_python_env.json
Created August 14, 2020 12:58
Auto Activate env specific python in terminal of vscode
{
"python.pythonPath": "C:\\Anaconda3\\envs\\kedro-practice\\python.exe",
"python.terminal.activateEnvironment": true,
"python.condaPath":"C:\\Anaconda3\\Scripts\\conda.exe"
}
@Yougigun
Yougigun / withErrorHandler.js
Created July 29, 2020 13:40
Handle Request and Response Error
import React, {useEffect,useState}from 'react';
import Modal from '../../components/UI/Modal/Modal'
import Aux from '../Auxiliary/Auxiliary'
const withErrorHandler = (WrappedComponent,axios) => {
return (props)=>{
const [state, setstate] = useState({error:null})
let completed = true;
let learnJS = new Promise(function (resolve, reject) {
if (completed) {
resolve("I have completed learning JS.");
} else {
reject("I haven't completed learning JS yet.");
}
});