Skip to content

Instantly share code, notes, and snippets.

View xfgavin's full-sized avatar

Feng Xue xfgavin

View GitHub Profile
@xfgavin
xfgavin / sshtunnel.service
Created June 3, 2022 19:42
Yet another WORKING autossh systemd script
[Unit]
Description=Keeps a tunnel to 'remote.com' open
After=network.target network-online.target sshd.service
#####################
#Reference: https://transang.me/create-a-remote-ssh-background-service-with-autossh-and-systemctl/
[Service]
User=YOUR_USER_NAME
Environment="AUTOSSH_GATETIME=30"
Environment="AUTOSSH_POLL=30"
@xfgavin
xfgavin / vmware-workstation-khugepaged-fix.md
Created June 9, 2021 07:07 — forked from 2E0PGS/vmware-workstation-khugepaged-fix.md
Fixing khugepaged CPU usage VMware Workstation

If you run VMware Workstation 11 or above you may encounter high CPU usage from process khugepaged on Ubuntu 15.04+

The fix is to disable transparent hugepages. It seems Ubuntu has it enabled by default.

You can check the current status on your system by running:

cat /sys/kernel/mm/transparent_hugepage/enabled

cat /sys/kernel/mm/transparent_hugepage/defrag

@xfgavin
xfgavin / System Design.md
Created June 7, 2021 07:55 — 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?
@xfgavin
xfgavin / latency.txt
Created June 7, 2021 07:53 — 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