GCloud: List roles a service account is a member of

GCloud command to list roles a service account is a member of:

gcloud projects get-iam-policy $GCP_PROJECT \
--flatten="bindings[].members" \
--format='table(bindings.role)' \

Reference: https://jamiekt.wordpress.com/2019/06/13/use-gcloud-to-list-all-project-roles-that-a-service-account-is-a-member-of/

iTerm2: Add Keystroke to move between words

On a Mac, I use iTerm2 as my default terminal due to the added features, such as auto-copy and the ability to split multiple terminals. One nuance was not having the ability to move between words (like in vim); however, I found the below how-to on Stack Overflow — where else? 🙂

  1. Go to Preferences, Profile, Keys.
  2. Set your left ? key to act as an escape character.
  3. Locate the current shortcut for ? ? or create a new one, with the following settings:
    • Keyboard Shortcut: ??
    • Action: Send Escape Sequence
    • Esc+: b
  4. repeat for the ?? keyboard shortcut with the following settings:
    • Keyboard Shortcut: ??
    • Action: Send Escape Sequence
    • Esc+: f

From this point, you can use Option + [left/right arrow keys]. Yass, productivity skill level increase! Later.

How to add environment variables in Mac OS X

Adding here for reference (tried this in Mac OS X Mojave):

# To set an environment variable, enter the following command:
launchctl setenv variable "value"

# To find out if an environment variable is set, use the following command:
launchctl getenv variable

# To clear an environment variable, use the following command:
launchctl unsetenv variable

Gatling How-To: Installation and Execution on OS X

This is here for my own reference, but may help others.  I’m a software craftsman on a Mac, and I use Homebrew whenever possible.  So, the info here relates to that.

Prerequisite: Java must be installed (i.e. brew cask install java).

      1. Install Scala via Homebrew: brew install scala
        • Optionally: Install Scala plugin in IntelliJ
      2. Download from https://gatling.io/download/
      3. Extract and place the folder in /usr/local/Cellar/gatling/gatling-charts-highcharts-bundle-2.3.1
      4. Navigate to gatling folder
      5. Set the directory settings in /conf/gatling.conf
      6. Create a test.scala file in /user-files/simulations
      7. Go to the terminal and run /usr/local/Cellar/gatling/gatling-charts-highcharts-bundle-2.3.1/bin/gatling.sh
      8. To run from IntelliJ via Maven:
        gatling:execute -Dgatling.simulationClass=TestSimulation -f pom.xml