On ubuntu machine:
- Run sudo apt install git
- git clone https://github.com/viktomas/dotfiles.git ~/.dotfiles
- cd ~/.dotfiles
- ./ubuntu-install-basic.sh
- ./install.sh
It's a good idea to start all the scripts with comma, so I can easily autocomplete only my personal commands https://rhodesmill.org/brandon/2009/commands-with-comma/ .
Edit crontab by running ./bin/edit-crontab.sh
.
- Configured to use different
.gitconfig
for work and private repos based on How to use different git emails · Hao's learning log
- replacing visually selected text by pressing
p
removes leading spaces. Fix it
Run the following script step by step to set up automatic screenshot resizing:
# Install imagemagick
brew install imagemagick
# Resize to 50%
# Source https://legacy.imagemagick.org/Usage/resize/
convert original.png -resize 50% resized.png
# install color quantifier
brew install pngquant
# Quantize 32-bit RGBA PNG to 8-bit (or smaller) RGBA-palette
# pngquant [number of colors] [options] input.png
# --skip-if-larger only save converted file if they're smaller than original
# --strip remove optional metadata
# --ext=.png set output filename to be same as input filename
# --force overwrite existing output files
pngquant 256 --skip-if-larger --strip --ext=.png --force example.png
# Install zopfli using Homebrew, which includes zopflipng
brew install zopfli
# Optimize PNG compression
# zopflipng [options] input.png output.png
# -y do not ask about overwriting files
zopflipng -y example.png example.png
# Create a Screenshots directory in the current users Home directory
mkdir -p "$HOME/Screenshots"
# Configure macOS to capture screenshots to this location
# If you want to revert this change, and save screenshots to your desktop,
# instead use "$HOME/Desktop"
defaults write com.apple.screencapture location "$HOME/Screenshots"
# Create new folder action in Mac automator, set it to Screenshots folder and add
# "Run Shell Script block"
# set it to /bin/zsh shell
# select "pass input" as arguments
# and add
for f in "$@"
do
/usr/local/bin/convert "$f" -resize 50% "$f"
/usr/local/bin/pngquant 64 --skip-if-larger --strip --ext=.png --force "$f"
/usr/local/bin/zopflipng -y "$f" "$f"
osascript -e "set the clipboard to (read (POSIX file \"$(readlink -f "$f")\") as {«class PNGf»})"
done
Inspired by One simple trick to make your screenshots 80% smaller | GitLab
- Now you can run CMD + Shift + 4 and use spacebar to switch between crosshair and whole app snapshot
- You can also remove app window shadow by holding option