Skip to content

Instantly share code, notes, and snippets.

View qzhuyan's full-sized avatar
🎯
Focusing

William Yang qzhuyan

🎯
Focusing
View GitHub Profile
@brunneis
brunneis / fix-hibernation.md
Last active September 3, 2023 11:19
Fix hibernation / deep sleep issues on MacBook Pro 2013 / 2014 with a NVMe SSD

alt + command + p + r + power

sudo pmset -a hibernatemode 0 standby 0 autopoweroff 0

Default:

sudo pmset restoredefaults
pmset -g
@svet-b
svet-b / bigdashboard_output.pdf
Last active February 26, 2024 16:01
PDF export of Grafana dashboard using puppeteer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env bash
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
@CMCDragonkai
CMCDragonkai / memory_layout.md
Last active April 18, 2024 08:54
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore
@trustin
trustin / noroaming.patch
Created September 12, 2015 08:00
broadcom-wl patch that fixes the crash on multi-AP environment
diff -urN a/src/wl/sys/wl_cfg80211_hybrid.c b/src/wl/sys/wl_cfg80211_hybrid.c
--- a/src/wl/sys/wl_cfg80211_hybrid.c 2015-09-12 16:39:28.000000000 +0900
+++ b/src/wl/sys/wl_cfg80211_hybrid.c 2015-09-12 16:50:44.908084821 +0900
@@ -2150,8 +2150,12 @@
WL_DBG(("\n"));
if (status == WLC_E_STATUS_SUCCESS) {
- err = wl_bss_roaming_done(wl, ndev, e, data);
- wl->profile->active = true;
+ if (!wl_bss_roaming_done(wl, ndev, e, data)) {
@shamil
shamil / mount_qcow2.md
Last active April 25, 2024 04:43
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@jboner
jboner / latency.txt
Last active April 25, 2024 01:18
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