Check These Out
An example of zsh glob qualifiers.
This is a big time saver for me. I often grep source code and need to edit the findings. A single highlight of the mouse and middle mouse click (in gnome terminal) and I'm editing the exact line I just found. The color highlighting helps interpret the data.
Branch name may be substituted, of course.
tail -c 1 "$1" returns the last byte in the file.
Command substitution deletes any trailing newlines, so if the file ended in a newline $(tail -c 1 "$1") is now empty, and the -z test succeeds.
However, $a will also be empty for an empty file, so we add -s "$1" to check that the file has a size greater than zero.
Finally, -f "$1" checks that the file is a regular file -- not a directory or a socket, etc.
it compresses the files and folders to stdout, secure copies it to the server's stdin and runs tar there to extract the input and output to whatever destination using -C. if you emit "-C /destination", it will extract it to the home folder of the user, much like `scp file user@server:`.
the "v" in the tar command can be removed for no verbosity.
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
When you run an X program from a terminal you can see any errors. But when it's run from another X program (eg from a menu item, from your fluxbox 'keys' file etc) it might just die and you see nothing (except perhaps in .xsession-errors). Instead, launch it via this command and you'll see the termination status, stderr and stdout.
eg: "xlaunch firefox" or "xlaunch 'echo stdout; echo stderr >&2; false'":
'echo stdout; echo stderr >&2; false' failed with error 1
STDERR:
stderr
STDOUT:
stdout
With sed you can replace strings on the fly.