Skip to content

Instantly share code, notes, and snippets.

@mesquka
Last active April 5, 2024 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mesquka/87804ca3c1d6276796547d4f8554fdf4 to your computer and use it in GitHub Desktop.
Save mesquka/87804ca3c1d6276796547d4f8554fdf4 to your computer and use it in GitHub Desktop.
Utility scripts for bin folder :)

Utility bin scripts

#!/bin/sh
# VSCode for VISUAL and EDITOR uses (git, crontab, etc.)
if [[ "$TERM_PROGRAM" = "vscode" ]]
then
code --reuse-window --wait "$@"
else
code --new-window --wait "$@"
fi
#!/bin/sh
# Disables sleep on macbook lid close
sudo pmset -a disablesleep 1
#!/bin/sh
# Enables sleep on macbook lid close
sudo pmset -a disablesleep 0
#!/bin/sh
# Kills all adobe processes (prevents battery drain)
sudo pkill -f -i adobe
#!/bin/sh
# Immediately start screensaver from CLI
open -b com.apple.ScreenSaver.Engine
#!/bin/sh
# Use exiftool to organize photos
# Renames file name to time of capture (DateTimeOriginal) for file name based sorters
# Sets FileModifyDate to date captured (DateTimeOriginal) for file metadata based sorters
exiftool '-filename<DateTimeOriginal' -d %Y%m%d_%H%M%S%%-c.%%le *
exiftool "-FileModifyDate<DateTimeOriginal" *
#!/bin/sh
# Resets launchpad layout
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
#!/bin/bash
# Uses screen to start and resume long running sessions over SSH
ssh $1 -t "screen -R"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment