Skip to content

Instantly share code, notes, and snippets.

View UgRoss's full-sized avatar

Rostyslav Ugryniuk UgRoss

View GitHub Profile
defaults write com.apple.dock persistent-apps -array-add '{tile-type="spacer-tile";}' && killall dock
@UgRoss
UgRoss / mac: copy ssh key
Created May 14, 2021 12:33
Copy SSH key
pbcopy < ~/.ssh/id_rsa.pub
@UgRoss
UgRoss / tokens.md
Created April 14, 2021 07:24 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@UgRoss
UgRoss / clean_code.md
Created March 22, 2021 18:38 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@UgRoss
UgRoss / mac: check busy port.sh
Last active February 26, 2021 10:24
mac: check what program is using port 8000
lsof -i :8000 | grep LISTEN
@UgRoss
UgRoss / mac: change default screenshots folder.sh
Created January 1, 2021 09:10
Change Mac OS default screenshot directory
defaults write com.apple.screencapture location ~/Documents/screenshots
@UgRoss
UgRoss / fix-refresh-rate.sh
Created May 21, 2020 09:09
How to change refresh rate on an external display on macOS
# install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install cscreen
brew cask install cscreen
# list displays
cscreen -l
# find your external screen in the list and write the number (not the ID) down somewhere
# in the following instructions, use that number instead of <SCREEN>
@UgRoss
UgRoss / git: checkout to previous branch.sh
Last active March 29, 2020 00:30
Git checkout to previous branch
git checkout @{-1}
@UgRoss
UgRoss / ubuntu: disable dock full width.sh
Last active March 28, 2020 17:51
Ubuntu disable dock full width
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
@UgRoss
UgRoss / npm: update all globally installed packages.sh
Created March 10, 2020 19:26
npm: update all globally installed packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f2)
do
npm -g install "$package"
done