From the man pages:
-
Single port:
nc -zv 127.0.0.1 80
-
Multiple ports:
nc -zv 127.0.0.1 22 80 8080
| # Remove duplicates from zsh_history: | |
| $ cat -n .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2- > .zsh_no_duplicates_history | |
| $ mv .zsh_no_duplicates_history .zsh_history | |
| # In case of failure (i.e, `sort: Illegal byte sequence`), debug | |
| # replacing the command above with `head`: | |
| $ head -n 10000 .zsh_history | sort -t ';' -uk2 | sort -nk1 | cut -f2- |
| # find string accross all git revisions | |
| git grep "string/regexp" $(git rev-list --all) | |
| # diff file between two different branches or tags | |
| git diff master 21.5.5.1 src/files/example.txt | |
| # show file history | |
| git log --stat src/customProperties.json | |
| git log --graph src/customProperties.json |
| #!/bin/bash | |
| # | |
| # see: http://blog.tomtung.com/2009/11/cowsay-fortune | |
| # http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed | |
| # https://github.com/busyloop/lolcat | |
| # https://github.com/dorentus/mruby-lolcat-bin | |
| # | |
| # requires `fortune`, `cowsay`, | |
| # and ruby gem `lolcat` or its mruby version equivalent |
| version: '3.9' | |
| services: | |
| rdu: | |
| image: your/image/here | |
| ports: | |
| - "50000:50000" | |
| - "8443:8443" | |
| - "49540:49540" | |
| environment: | |
| - "JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,address=49540,server=y" |
| # https://blog.mimacom.com/artifactory-latest-version/ | |
| curl -s $(curl -s $(curl -s "$ARTIFACTORY_URL/$REPO_URL?lastModified" | jq -r '.uri') | jq -r '.downloadUri' ) | |
| # with basic auth and defining output directory | |
| curl -u$ARTIFACTORY_USER:$ARTIFACTORY_TOKEN -O --output /tmp -s ... |
| # Credit http://stackoverflow.com/a/2514279 | |
| for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r |
| git checkout branch_to_be_renamed | |
| git branch -m branch_to_be_renamed new_branch_name | |
| git push origin --delete branch_to_be_renamed | |
| git push origin -u new_branch_name | |
| ###### | |
| # -u, --set-upstream | |
| # For every branch that is up to date or successfully pushed, add upstream (tracking) | |
| # reference, used by argument-less git-pull(1) and other commands. For more information, see | |
| # branch.<name>.merge in git-config(1). |
| grep -rnw . -e 'TEXT TO FIND' |
| sed -r 's/\"(R\$\s*)([0-9]{0,})\.?([0-9]{0,})\.?([0-9]{1,})\.?([0-9]{0,3})\"/\2\3\4\5/g' input.json > output.json |