Skip to content

Instantly share code, notes, and snippets.

@tingwei628
tingwei628 / 1_simple.go
Created April 18, 2022 19:00 — forked from sosedoff/1_simple.go
Golang Custom Struct Tags Example
package main
import (
"fmt"
"reflect"
)
// Name of the struct tag used in examples
const tagName = "validate"
@tingwei628
tingwei628 / delete_dotnet_core.sh
Created March 5, 2022 13:03
Manually delete unnecessary sdks and runtimes in .Net Core
# Step 1: target at versions you want to delete
# Step 2: chmod +x delete_dotnet_core.sh
# Step 3: ./delete_dotnet_core.sh
# Target sdks to remove
declare -a sdkVersions=("3.0.101" "3.1.401")
for sdkVersion in "${sdkVersions[@]}"
do
sudo rm -rf /usr/local/share/dotnet/sdk/$sdkVersion
# sudo rm -rf /usr/local/share/dotnet/sdk-manifests/$sdkVersion
@tingwei628
tingwei628 / challenge1.md
Last active March 4, 2022 18:24
read a big txt in C#
@tingwei628
tingwei628 / k8s-horizontals-getting-started.md
Created February 15, 2022 09:47 — forked from MadhavJivrajani/k8s-horizontals-getting-started.md
This is a list of resources that I personally found helpful while trying to understand containers and kubernetes from a big-picture POV.

Getting Started With Kubernetes On A High Level

One of biggest barriers when trying to get started with Kubernetes is that there's so much content out there that it's kinda overwhelming - and that's totally normal! The intent of this document is to try and provide directed resources in a roadmap like fashion to understand and learn about the horizontals of Kubernetes - post which you can dive deep into any vertical while keeping the bigger picture in mind - that this document hopes to provide.

This is a set of resources for different topics that I found particularly helpful when getting started, and hopefully you do too! I've tried to list them out in order of consumption. If A comes before B under a subtopic, then it's probably that A has topics needed for B, or that A attempts to explain topics of B in a slightly simpler (not nescessarily better) manner than B.

Containers

Feel free to skip over if you're already familiar with containers and have some idea about what they are and why they exist.

@tingwei628
tingwei628 / COOL_compiler_note.md
Last active October 24, 2021 14:04
COOL compiler note

Backend

IR -> IR Optimization -> Code Generation(Register allocation/Instruction selection) Assembly

Code generation

1.top-of-stack caching (1-TOSCA)
2.init garbage collector

Object layout

1.similar to C++ inheritance \

@tingwei628
tingwei628 / aarch64_on_mac.md
Last active August 29, 2021 07:32
aarch64 on mac

update: I used dockcross instead.

compile .c into aarch64(arm64v8) with ELF format

brew tap SergioBenitez/osxct
brew install aarch64-none-elf
@tingwei628
tingwei628 / latency.txt
Created July 13, 2021 14:35 — 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
@tingwei628
tingwei628 / kernel-dev.md
Created June 23, 2021 10:39 — forked from vegard/kernel-dev.md
Getting started with Linux kernel development

Getting started with Linux kernel development

Prerequisites

The Linux kernel is written in C, so you should have at least a basic understanding of C before diving into kernel work. You don't need expert level C knowledge, since you can always pick some things up underway, but it certainly helps to know the language and to have written some userspace C programs already.

It will also help to be a Linux user. If you have never used Linux before, it's probably a good idea to download a distro and get comfortable with it before you start doing kernel work.

Lastly, knowing git is not actually required, but can really help you (since you can dig through changelogs and search for information you'll need). At a minimum you should probably be able to clone the git repository to a local directory.

@tingwei628
tingwei628 / Risc-V_toolchain_installation_mac.md
Last active June 7, 2021 10:55
Risc-V toolchain installation on mac

Env: macOS Catalina 10.15.7

Step1: git clone --recursive https://github.com/riscv/riscv-gnu-toolchain

Although it doesn't need --recursive in README, this issue still happened on mac.

Step2: brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat

Step3: cd riscv-gnu-toolchain directory and ./configure --prefix=/opt/riscv --enable-multilib

To build either cross-compiler with support for both 32-bit and 64-bit