Skip to content

viktomas/dotfiles

Repository files navigation

Dotfiles

On ubuntu machine:

  1. Run sudo apt install git
  2. git clone https://github.com/viktomas/dotfiles.git ~/.dotfiles
  3. cd ~/.dotfiles
  4. ./ubuntu-install-basic.sh
  5. ./install.sh

Bin

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/ .

Crontab

Edit crontab by running ./bin/edit-crontab.sh.

Git

neovim

  • replacing visually selected text by pressing p removes leading spaces. Fix it

Mac-specific setup

Resize screenshots and add them to clipboard

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

About

My dotfiles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages