[[Goto function definition starting from cursor position'',`'Return to previous cursor position{Go back to previous linegap,}go to next linegapdggRemove from current position to begining of filedGRemove from current to end of file#,*search and highlight the word under current cursor in the whole file.mato set mark at position a,'ato go to line at mark a, or`ato go to exact column at agdto go to local variable initialisation. (gd = Goto Declaration)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3' | |
| services: | |
| consul-agent-1: &consul-agent | |
| image: consul:latest | |
| networks: | |
| - consul-demo | |
| command: "agent -retry-join consul-server-bootstrap -client 0.0.0.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # iptables configuration | |
| # | |
| # The following allows in- and outbound traffic | |
| # within a certain `CIDR` (default: `192.168.0.0/24`), | |
| # but blocks all other network traffic. | |
| # | |
| ALLOWED_CIDR1=172.0.0.0/16 | |
| ALLOWED_CIDR2=13.233.249.192 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM python:3 | |
| EXPOSE 8000 | |
| CMD ["python", "-m", "http.server"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ## Below script allows to fetch private github/gitlab repo | |
| ## Assume, $PRIVATE_SSH = | |
| ## -----BEGIN OPENSSH PRIVATE KEY----- | |
| ## b3BlbnNzaC1rZXktdjEAAAAABG5..... | |
| cat > /root/.ssh/id_rsa <<EOF | |
| -----BEGIN OPENSSH PRIVATE KEY----- | |
| b3BlbnNzaC1rZXktdjEAAAAABG5..... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ##Useage: ./getes.sh | |
| ## To dry run query: ./getes.sh -v -x POST -d '{a:b}' http://elasticurl | |
| ## To actually run query: ./getes.sh -x POST -d '{a:b}' http://elasticurl | |
| ## Default action is search, so you can omitt -x GET switch | |
| METHOD="GET" | |
| DATA="{}" | |
| DRYRUN=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #log_format custom '$request_body'; | |
| log_format custom '$remote_addr - $remote_user [$time_local] ' | |
| '"$request" $status $bytes_sent ' | |
| '"$http_referer" "$http_user_agent" "$request_body"'; | |
| log_format json_combined escape=json | |
| '{' | |
| '"time_local":"$time_local",' | |
| '"remote_addr":"$remote_addr",' | |
| '"remote_user":"$remote_user",' |
-
Toggle hidden files I
-
Create new file at given directory cursor: ma
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. Extract all (PHP) requests from apache access.log: | |
| grep -Eo '"POST /[a-zA-Z0-9_ ]+/[a-zA-Z0-9_]+.php HTTP/1.1"' access.log | |
| 2. find all urls in a folder across all files: | |
| grep -rnEo "(http|https)://[a-zA-Z0-9./?=_-]*" folder/ | |
| 3. SED delete range of lines in a huge text files: | |
| sed -i '21,141d' file |
Ref: https://stackoverflow.com/a/44789323
-
create a new branch
git checkout -b new_clean_branch -
apply all changes