List the Roles for a User or Service Account in a Specific GCP Project

If you do not have web console permissions to do so, but have the ability to activate a service account that has the viewer permissions or IAM permissons to list IAM roles in a given project, the following is how you can list the roles for a given user or service account.

gcloud projects get-iam-policy <gcp-project\
--filter="bindings.members:<email-address" \
--flatten="bindings[].members" --format="table(bindings.role)"
Continue reading “List the Roles for a User or Service Account in a Specific GCP Project”

Compiling Python 3.8.x Under Linux

Yes, I know. 3.8.x? That’s an older version of Python but there are still a number of current applications and libs that require 3.8 as well as a number of distros that still have 3.8 as the most recent easily installable version. With that being said, the following is a quick how to on getting it compiled under both RedHat/CentOS/Almalinux and Debian based systems.

Install Dependencies

This assumes that you already have the “build-essentials” and kernel headers installed on the → Continue reading “Compiling Python 3.8.x Under Linux”

Using fc to Edit and Re-execute Bash Commands

I recently learned about the Bash built-in fc. It is a great tool that enables you to edit and re-execute commands from your bash history.

Oftentimes there is a command in your history that instead of just grepping through the history and then re-executing as-is you’ll want to make a modification or two. With fc you can first edit it in your favorite editor and then when closing the editor fc will execute the command.

For me, vim is my → Continue reading “Using fc to Edit and Re-execute Bash Commands”

Fluffy Waffles

Ingredients

  • 1 3/4 cups Flour
  • 2 teaspoons baking powder
  • 1/2 teaspoon salt
  • 1 tablespoon sugar or 1 tablespoon honey
  • 3 eggs – separated
  • 1 1/2 cup milk
  • 1/3 cup vegetable oil
  • 1/4 tsp vanilla

Instructions

  1. Sift dry ingredients in a bowl
  2. Add egg yolks, milk, vegetable oil, and vanilla to dry ingredients – using a mixer, beat thoroughly
  3. Beat egg whites until stiff and gently fold egg whites into batter
  4. For use in waffle iron – Follow manufacturer directions! Makes
Continue reading “Fluffy Waffles”

Black Bean Cupcakes

Makes about 12 cupcakes.

Ingredients

Cupcakes

  • 1/2 cups black beans cooked and drained
  • 3 large eggs
  • 1 cup plus 2 tablespoons granulated sugar
  • 4 tablespoons unsalted melted butter
  • 1/2 cups cocoa powder
  • 1 teaspoon instant cofee
  • 1 teaspoon vanilla extract
  • 1/2 teaspoon baking soda
  • 1/2 teaspoon salt
  • 1/3 cup of chopped dark chocolate

Glaze

  • 4 tablespoons unsalted butter
  • 1 tablespoons cocoa powder
  • 1/2 cup powdered sugar

Instructions

Cupcakes

  1. Preheat seep to 350F
  2. In a blender add all at the ingredients
Continue reading “Black Bean Cupcakes”

Creating a Launch Config in VSCode to Debug a Python Invoke Script

I regularly use Python Invoke and Fabric for the automation of various tasks; from deploying code to developing my own set of tools for various projects. Following is an example on how to write a launch.json launch configuration for vscode so that you can step through the tasks.py code and debug it.

Assuming that you have created a virtual environment and pip installed invoke into it. And, assuming that you have defined a task in your tasks.py file as follows:→ Continue reading “Creating a Launch Config in VSCode to Debug a Python Invoke Script”

Using bq load Command to Load logicalType Partitioned Data into a BigQuery Table

Following is the syntax and bq load command that you need to issue if you want to load data in avro file into a partitioned BigQuery table based on avro field defined as a logicalType.

Given the following schema

{
  "type" : "record",
  "name" : "logicalType",
  "namespace" : "com.ryanchapin.tests",
  "fields" : [ {
    "name" : "id",
    "type" : [ "null", "string" ],
    "default" : null
  }, {
    "name" : "value",
    "type" : [ "null", "long" ],
    "default" : null
  }, 
Continue reading “Using bq load Command to Load logicalType Partitioned Data into a BigQuery Table”

Sheet Pan Mushroom and Gnocchi

Ingredients

  • 1 pound mixed wild mushrooms
  • 2 medium shallots
  • 1 pound fresh, shelf-stable, or frozen potato gnocchi
  • 3 tablespoons olive oil
  • 1/2 teaspoon kosher salt
  • 1/4 teaspoon freshly ground black pepper
  • Fresh thyme leaves, for garnish

Instructions

  1. Preheat oven to 400F
  2. Slice mushrooms, chop shallots
  3. Place mushroom, shallots, and gnocchi in a mixing bowl and drizzle with olive oil. Add seasoning and toss to coat oil and seasonings.
  4. Turn out onto baking sheet in an even layer
  5. Roast for about
Continue reading “Sheet Pan Mushroom and Gnocchi”