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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # Common options to use with ls command | |
| # How to sort | |
| # |
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
| // Generate page numbers like Google does | |
| function pager_numerate_google(active, total, display) | |
| { | |
| const begin = Math.max(1, active - Math.floor(display/2)); | |
| const length = Math.min(total, display); | |
| const x = Math.min(0, total + 1 - begin - length); | |
| return Array(length).fill(0).map((v,i) => begin + i + x) | |
| .map(v => v == active ? `[${v}]` : v); | |
| } |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # POST as multipart/form-data with curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| curl https://echo.vbarbarosh.com \ |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # POST as application/json with curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| curl https://echo.vbarbarosh.com -H Content-Type:application/json |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| script=`realpath $0` | |
| scriptdir=`dirname $script` | |
| scriptname=`basename $script` |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # POST as application/javascript with curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| curl https://echo.vbarbarosh.com -H Content-Type:application/javascript \ |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # A way to use curl in pipeline | |
| # https://curl.haxx.se/docs/manpage.html | |
| # Input from stdin, output to stdout |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # Common options for curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| # -s silent, -f fail --- should be used in shell scripts |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # Sending and receiving headers with curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| # Show HTTP request and response headers |
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 | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # Sending HEAD requests with curl | |
| # https://curl.haxx.se/docs/manpage.html | |
| curl -I https://httpbin.org/status/400 |