Skip to content

Instantly share code, notes, and snippets.

@oleksiiBobko
Last active December 18, 2022 17:51
Show Gist options
  • Save oleksiiBobko/ca90d95cccf624a12c0b35275566dc19 to your computer and use it in GitHub Desktop.
Save oleksiiBobko/ca90d95cccf624a12c0b35275566dc19 to your computer and use it in GitHub Desktop.
#remove all .orig files in a particular directory recursively
find . -name '*.orig' -delete
#rebase
git rebase -i HEAD~3
#undo commit and redo:
$ git commit -m "Something terribly misguided"
$ git reset HEAD~
#edit files as necessary
$ git add ...
$ git commit -c ORIG_HEAD
#symbolyc link create
ln -s {path/to/file-name} {link-name}
#symbolyc link update
ln -sfn {path/to/file-name} {link-name}
#show commit tree
git log --graph --abbrev-commit --decorate --date=relative --all
git log --graph --oneline --decorate --date=relative --all
#lookup directory to find text in files
grep -iRn --include="*.java" "ShutdownService" .
#remove branch both local and remote
git branch -d the_local_branch
git push origin :the_remote_branch
#run application with output redirection
appname > /dev/null 2>&1 &
#git diff last commit
git diff HEAD^ HEAD
#maven webapp archetype
mvn archetype:generate -DgroupId=org.somedomain
-DartifactId=project-name
-DarchetypeArtifactId=maven-archetype-webapp
-DinteractiveMode=false
#copy to clipboard cygwin
cat [filename] > /dev/clipboard
#turn on/off fn key on apple kb
echo 0 > /sys/module/hid_apple/parameters/fnmode
- 0 = Fn key disabled
- 1 = Fn key pressed by default
- 2 = Fn key released by default
#search some line in files(color output)
grep --color=always -rnw <path> -e '<pattern>'
#generate ssh key pair
ssh-keygen -t rsa -b 4096 -C "name@mail.com"
#copy key on server
ssh-copy-id user@domain
#view dependency tree on maven project
mvn dependency:tree
#generate strong password
head /dev/urandom | tr -dc 'A-Za-z0-9!@#$%^&*()_+=' | head -c 13 ; echo ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment