Skip to content

Instantly share code, notes, and snippets.

View UgRoss's full-sized avatar

Rostyslav Ugryniuk UgRoss

View GitHub Profile
@UgRoss
UgRoss / git: fix not pushed the last commit message.sh
Created March 1, 2020 22:15
Scenario: You just typo’d the last commit message, but before git push you realized that you wanted to have another commit message
git commit --amend -m "📝Message"
@UgRoss
UgRoss / mac: show hidden files
Created February 25, 2020 19:35
mac: show hidden files
defaults write com.apple.finder AppleShowAllFiles YES
git rm --cached -r <dir>
@UgRoss
UgRoss / js: get random item from an array.js
Last active January 1, 2021 09:12
Get random item from an array
arr[Math.floor(Math.random() * arr.length)];
@UgRoss
UgRoss / bash: mkdir + cd to this folder.sh
Created December 6, 2019 00:17
Create folder and navigate to it
mkdir folderName && cd "$_"
@UgRoss
UgRoss / js: set CSS variable.js
Created December 6, 2019 00:07
Set CSS variables using JavaScript
document.documentElement.style.setProperty('--bg-color', '#ccc');
@UgRoss
UgRoss / js: get CSS variable.js
Last active December 6, 2019 00:08
Get CSS variable using JavaScript
const bgColor = getComputedStyle(document.documentElement).getPropertyValue('--bg-color');
@UgRoss
UgRoss / git: Change old commit message.sh
Created December 4, 2019 23:36
It is bad practice to rewrite history. Do it best if no one is working on the same repository as you.
# 1. Rebase to the commit you want to change (~1 means the first ancestor of the specified commit)
git rebase -i <hash>~1
# Can also do this
git rebase -i HEAD~4 # where HEAD~4 = last 3 commits
# 2. Change pick to reword of the commit you want to change then save and quit
# 3. Change the commit message in the editor and save
@UgRoss
UgRoss / .Xmodmap
Last active August 22, 2019 15:26
Linux Mac Keyboard
clear control
clear mod4
keycode 105 =
keycode 206 =
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L
@UgRoss
UgRoss / ssh: copy-local-file.sh
Last active November 28, 2018 20:03
Copy local file to SSH
# scp /file/path username@a:/destionation/path
scp <source> <destination>