Skip to content

Instantly share code, notes, and snippets.

View levihuayuzhang's full-sized avatar

Levi Schwarzman levihuayuzhang

View GitHub Profile
@levihuayuzhang
levihuayuzhang / README.md
Last active February 26, 2026 11:48
Disable press & hold on MacOS VSCode.
defaults write com.microsoft.VSCode ApplePressAndHoldEnabled -bool false              # For VS Code
defaults write com.microsoft.VSCodeInsiders ApplePressAndHoldEnabled -bool false      # For VS Code Insider
defaults write com.vscodium ApplePressAndHoldEnabled -bool false                      # For VS Codium
defaults write com.microsoft.VSCodeExploration ApplePressAndHoldEnabled -bool false   # For VS Codium Exploration users
defaults write com.exafunction.windsurf ApplePressAndHoldEnabled -bool false          # For Windsurf
defaults delete -g ApplePressAndHoldEnabled                                           # If necessary, reset global default

Ref:

@levihuayuzhang
levihuayuzhang / README.md
Last active February 17, 2026 10:23
MacOS disable wake on power adpter.
pmset -g log | grep -i "wake"
pmset -g assertions

sudo pmset -a proximitywake 0
sudo pmset -a powernap 0
sudo pmset -a tcpkeepalive 0
sudo pmset -a womp 0

sudo pmset -a standby 1
@levihuayuzhang
levihuayuzhang / README.md
Last active January 26, 2026 06:05
Make MacOS26 Preview.app to remember last session (multi-windows)

check

defaults read com.apple.Preview NSQuitAlwaysKeepsWindows

set to true to save windows

defaults write com.apple.Preview NSQuitAlwaysKeepsWindows -bool true
@levihuayuzhang
levihuayuzhang / README.md
Created August 20, 2025 19:30
Rancher Desktop Mac proxy settings
  1. go to lima shell:
rdctl shell
  1. change configs:
sudo vi /etc/conf.d/docker
@levihuayuzhang
levihuayuzhang / BUILD
Created August 14, 2025 09:26 — forked from bsilver8192/BUILD
Basics of generating a compile_commands.json file with Bazel
py_binary(
name = 'generate_compile_command',
srcs = [
'generate_compile_command.py',
],
deps = [
'//third_party/bazel:extra_actions_proto_py',
],
)
@levihuayuzhang
levihuayuzhang / config.yml
Created August 4, 2025 06:55 — forked from trxcllnt/config.yml
basic `clangd` C/C++/CUDA config
# Apply this config conditionally to all C files
If:
PathMatch: .*\.(c|h)$
CompileFlags:
Compiler: /usr/bin/gcc
---
# Apply this config conditionally to all C++ files
If:
@levihuayuzhang
levihuayuzhang / download.sh
Created July 9, 2025 16:49 — forked from Aries0d0f/download.sh
Download all macOS Sonoma Aerial wallpaper
#!/bin/zsh
# This script helps those who want to
# get all Aerial wallpapers on macOS Sonoma
# all at once instead of clicking on settings one by one.
# Dependencies: jq, parallel
# Install all dependencies via `brew install jq parallel`
# After `parallel` installed run `sudo parallel --citation` first to read citation notice (IMPORTANT)
@levihuayuzhang
levihuayuzhang / gnome_set_fractional_scaling.md
Last active May 19, 2025 14:55
gnome set fractional scaling
  1. echo $XDG_SESSION_TYPE
sudo cp ~/.config/monitors.xml ~gdm/.config/monitors.xml
sudo chown gdm:gdm ~gdm/.config/monitors.xml
  1. for GDM:
sudo machinectl shell gdm@ /bin/bash
@levihuayuzhang
levihuayuzhang / remove-window-button-.md
Last active February 12, 2026 04:04
Remove window button in Linux.
  1. move to right: gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'
  2. move to left: gsettings set org.gnome.desktop.wm.preferences button-layout 'close,minimize,maximize:'
  3. remove: gsettings set org.gnome.desktop.wm.preferences button-layout :
  4. get current: gsettings get org.gnome.desktop.wm.preferences button-layout
  5. reset all settings dconf reset -f /
@levihuayuzhang
levihuayuzhang / auto-close-screen-tty.md
Last active April 22, 2025 08:17
Auto close screen without DE (in TTY)
  1. set in grub config (blank in 60 seconds)
GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=60"
  1. setterm -blank X (X in minutes) in shell init file (.bashrc) or /etc/rc.local.

Then, prevent sleep when lid close: sudoedit /etc/systemd/logind.conf:

HandleLidSwitch=ignore