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 / 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

@tingwei628
tingwei628 / resources.md
Created June 6, 2021 07:19 — forked from muff-in/resources.md
A curated list of Assembly Language / Reversing / Malware Analysis -resources