>Command + b : Search on the visible screen buffer.
git config --global --edit;
Global aliases are stored in file ~/.gitconfig
Create Git aliases:
git config --global alias.recent-branches "for-each-ref --sort=-committerdate refs/heads/ refs/remotes/ --format='%(committerdate:iso8601) %(refname:short)'"; # Usage: git recent-branches;
git config --global alias.stashsave '!f() { git stash push -m "$1"; }; f' # Usage: git stashsave "foo";
git config --global alias.aliases "config --get-regexp '^alias\.'"; git aliases; # Usage: git aliases;
chmod 600 ~/.ssh/id_rsa; # set keys permissions
cat id_rsa.pub | ssh [email protected] 'cat >> /home/ubuntu/.ssh/authorized_keys’;
/usr/bin/ssh-add --apple-use-keychain ~/.ssh/id_rsa; # Run the command given below if you don't want to type private key password every time using the public key to make ssh connection. It stores the passphrase for private key in OSX Keychain, you can verify this by opening "Keychain Access" app.
ssh-keygen -y -P "password" -f ~/.ssh/id_rsa; # Verify if the password is correct decrypt the private key.
ssh-keygen -p -f ~/.ssh/id_rsa; # Run this line to reset the passwor for case like you mistakenly entered wrong password in above command.
Requirements: $brew install g++ gdb coreutils;
map <C-s> = :w<cr> " save file
map <S-Left> = :!gdb ./%:r <CR> " Debug
map <S-Down> = :!g++-12 -std=c++14 -g % -o %:r<CR> " build only
map <S-Up> = :!./%:r <CR> " run only.
map <S-Right> = :!g++-12 -std=c++14 -g % -o %:r && gtimeout 4s ./%:r <CR> " build and run.
Backup, mirrorring, restoring tool. Uses delta transfer algorithm to only send changes instead of whole file, thereby reducing network load.
Syntax: $rsync [options] <source_destination> <remote_destination>;
$rsync -avr --exclude="*.pyc" --exclude="static" remote_host:/opt/backup/ .; # Pulling from remote to local.
$rsync -avr . remote_host:/opt/backup/; # Pushing from local to remote.
scp ~/Downloads/GoogleChrome/mongosh-1.6.2-linux-x64.tgz remote_host:/home/sysadmin/;
ssh remote_host;
(sysadmin ~)$ tar -zxvf mongosh-1.6.2-linux-x64.tgz;
(sysadmin ~/mongosh1.6/bin)$ cd mongosh*/bin/;¡
(sysadmin ~/mongosh1.6/bin)$ chmod +x ./*;
(sysadmin ~/mongosh1.6/bin)$ sudo cp mongosh* /usr/local/bin/;
(sysadmin ~)$ mongosh;
q[a-z] : record macro, do something, then press q again to stop recording. ie qa starts recording in register "a".
@[a-z] : to repeat the macro previously created.
q[A-Z] : Append at the end of the macro. eg qA will start appending to what was recorded in qa previously.
:register or :reg : Macro are stored in Vim’s registers.
“ayy : Yank current line to register a.
“Ay$ : Append content from current cursor position to line end into register "a".
“ap : Paste contents of register a in normal mode.
“+p : Paste contents of system clipboard. TODO: research “*p register.
.gitignore is the primary way to untrack files and folders. But, what if you want to do the same without using .gitignore file ?
- Ignoring untracked files ie files that are new or has not been added to git yet.
Note: the .git/info/exclude file doesnot get uploaded to remote.
$ touch my_local_file.txt; # Lets say, you don't want this file to be tracked by git.
$ git status -s; # You can see that git detects this file, but you don't want this to happen.
$ cd .git;