Skip to content

Instantly share code, notes, and snippets.

@donn
Last active September 10, 2023 18:40
Show Gist options
  • Save donn/3e1e740feb541dc02ce0f5a4802565c3 to your computer and use it in GitHub Desktop.
Save donn/3e1e740feb541dc02ce0f5a4802565c3 to your computer and use it in GitHub Desktop.
Shell Nonsense
# These are commands I find all around the internet that I think are interesting or useful, so I'll keep 'em here:
# (None of these are complex enough to qualify for copyright in my opinion)
# Generate MAC Address
# Credit: https://discussions.apple.com/message/29028339#message29028339
openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'
# LS alias with all the good stuff
alias ll='ls -lAFh'
# VNC over SSH
ssh -L 5900::5900 192.168.1.42
## Linux
# An actual decent gnome-screenshot keyboard shortcut
# also works when installing gnome-screenshot on KDE (im just used to it)
bash -c "SCREENCAP=\"\$HOME/Pictures/Screenshots/Screenshot at \$(date '+%Y-%m-%d %H:%M:%S').png\"; echo \"\$SCREENCAP\" && gnome-screenshot -ac -f \"\$SCREENCAP\" && xclip -i \"\$SCREENCAP\" -selection clipboard -t image/png"
# Latex on Manjaro
## For use with https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop
sudo pacman -S texlive-most biber
sudo cpan YAML::Tiny File::HomeDir
## Mac
# Mac VNC localhost only w/ password 00000000
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart\
-configure -clientopts -setvnclegacy\
-vnclegacy yes -setvncpw -vncpw 00000000
sudo defaults write\
/Library/Preferences/com.apple.RemoteManagement.plist \
VNCOnlyLocalConnections -bool yes
cd /System/Library/LaunchDaemons
sudo launchctl unload com.apple.screensharing.plist
sudo launchctl load com.apple.screensharing.plist
# Use architecture-specific shell on Macs with Rosetta
arch -arm64e zsh -l
# Set Resolution from CLI
brew install avibrazil-rdm
/Applications/RDM.app/Contents/MacOS/SetResX -w 1920 -h 1080 -s 1.0
# Change DNS
networksetup -setdnsservers "iPhone USB" "8.8.8.8" "8.8.4.4"
# Enable Debugging over SSH
sudo DevToolsSecurity -enable
## See Problem when trying to debug with lldb on new arm64 M1 - https://developer.apple.com/forums/thread/678032?answerId=670611022#670611022
## The Windoze Section
# Connecting to Windows servers via CLI
winrs -r:$SERVER_NAME cmd
## Notes on virtualizing Linux in Windows
# If you ever need to virtualize Linux on a Windows machine with a corporate DNS or whatever,
# copy /etc/resolv.conf from WSL to the Linux machine.
# If you're using Docker, remember Docker uses Google DNS by default and you would have to override that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment