Random query recipes of JMESPath for the AWS CLI tools that I might have written or stumbled upon.
- Random list of ascending numbers generated in
resultIndexListas seed list. - Set of random numbers generated, insert position determined by
insertAt()function. - Each value inserted using
resultIndexList.splice()to maintain sort order as progressing.
A pattern for recursion with Promises - in this example, walking a directory structure.
readDirRecursive()is called with a starting directory and will itself return aPromise.- Internally
readDir()is called and passed starting directory to read from. - A list of directory items is returned by
getItemList()as aPromise, which in turn is chained togetItemListStat()to stat each item to determine if file or directory. - Finalised list then passed to
processItemList():
The IFS internal variable is used to determine what characters Bash defines as word/item boundaries when processing character strings. By default set to whitespace characters of space, tab, and newline.
Running the example ifs.sh, comparing the difference between the default and setting only newline as a boundary we get the following output:
/path/to/first
file
/path/to/secondA quick n' dirty Bash script to install the following:
autoconf, needed by Git configure.git- from source.
Tested successfully under both Intel and M1 (ARM64) based architectures.
Requires as a minimum Xcode CLI tools (no need for a full install). Can be installed via the following:
Making a note of this because NetScalers at just awful at anything when it comes to messing with HTTP header cookie values.
So I wish to update the value of a Cookie key of mykey= to mykey=new_value. I can do so with the following rewrite action:
-
Type:
REPLACE -
Expression to choose target location:
HTTP.REQ.HEADER("Cookie") -
Expression:
By default calling a URL via urllib2 will follow any 30X responses returned, often not what you want.
We can correct this behavior by adding a custom "opener" class to the urllib2 module like so:
import urllib
import urllib2Without the need for Xcode bloat (yay!).
What is tig?: https://github.com/jonas/tig
# install gcc/make/etc.
# note: this will *not* install Xcode - don't be fooled by xcode in CLI command name
$ xcode-select --install