curl HTTPS Over an SSH Tunnel

If you want to execute curl commands on your local machine and connect to an HTTPS server that is only reachable from a bastion or other host through which you can only get to via SSH, the following is how you set up the SSH tunnel and execute the curl command.

The following will not work

# Create ssh tunnel
#
ssh -L localhost:8443:example.com:443 user@bastion.example.com

# Attempt to hit the endpoint otherwise accessible from bastion.example.com
# with curl -X GET 
Continue reading “curl HTTPS Over an SSH Tunnel”

Diffing the output of two commands

The GNU diff command on most Linux and UNIX systems will diff the contents of two files. With Bash, you can, using process substitution, take the output of any arbitrary command and process its input, or output, as a file descriptor. In this way, you can then use diff against the output of two commands as follows

diff <(cmd1) <(cmd2)

Both cmd1 and cmd2 will appear as a file name/file descriptor. The < character indicates that the file descriptor should → Continue reading “Diffing the output of two commands”

Stuffed Eggplant

This is a really delicious Indian dish that can be enjoyed with either roti or rice.

Ingredients

  • 10 – 12 small round brinjal (mini eggplants)
  • 1/2 TSP salt
  • 4 TBSP oil
  • 1 medium white or red onion, chopped
  • 6 – 7 dried red chilies
  • 2 TBSP coriander seeds
  • 1 TBSP cumin seeds
  • 1 TSP fenugreek seeds
  • 2 TSP sesame seeds
  • 9 cloves garlic
  • 1/4 cup of peanuts, or if you have a peanut allergy you can substitute with sliced almonds
Continue reading “Stuffed Eggplant”

Creating Custom Vagrant Boxes for Integration Testing

For some things, a docker container will not work. For example, I am working on a Python project to automate the deployment and configuration of VMs and bare-metal boxes. It involves installing packages and configuring the OS and to properly test it requires a full fledged VM and not just a container.

Use packer to define the box you want to build

Install packer. The description straight from apt show packer is “HashiCorp Packer – A tool for creating identical Continue reading “Creating Custom Vagrant Boxes for Integration Testing”

Using Environment Variables in a Vagrant File

An easy way to parameterize a Vagrant file is to use environment variables. You simply need to export a variable and then refer to it in the Vagrant file with the following syntax.

Export the variable:

export SSH_PORT=22222

Sample Vagrant file that reads the exported variable

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "debian/bullseye64"
  config.vm.box_version = "11.20221219.1"

  config.vm.network "forwarded_port", guest: 22, host: ENV['SSH_PORT']
end
Continue reading “Using Environment Variables in a Vagrant File”

Declaring, Exporting, and Reading Dynamic Variables in Bash

If you want to dynamically define and export variable names in Bash here is the TLDR;

# Define the name of the variable
key="my-dynamic-var-name"

# Declare it and export it
declare -gx "$key"="some-value"

To then access that value via a dynamically generated variable name

# Create a variable that contains the variable name
var_to_access="my-dynamic-var-name"

# Read the value
my_var_value=${!var_to_access}

Read the man page for declare for more details and read this article for a really good explanation and further examples.→ Continue reading “Declaring, Exporting, and Reading Dynamic Variables in Bash”

Chickpea and Rice Stew

Ingredients

  • 1.5 cups basmati rice
  • 1 TB olive oil
  • 1/4 cup olive oil
  • 1 cup yellow onion, diced
  • 2 (14 oz) cans chickpeas, drained
  • Salt & black pepper, to taste
  • 3 garlic cloves, minced
  • 1 tsp ground turmeric
  • 1/2 tsp crushed red pepper flakes
  • 1 lemon, juiced and zested
  • 1 (32 oz) box low sodium vegetable broth
  • 4 oz fresh baby spinach
  • 1/2 cup cilantro, chopped
  • 1/2 cup parsley, chopped
  • 1/4 cup dill, chopped
  • 1 TB chives, chopped
  • 4 Naan
Continue reading “Chickpea and Rice Stew”

Bean and Barley Leek Soup

Make 3 cups of cooked barley ahead of time and have it on hand when cooking the soup.

Ingredients

  • 2 Tablespoons olive oil
  • 3 cloves garlic, minced
  • 2 leeks, diced
  • 3 carrots, diced
  • 1 bulb fennel, sliced thin (1 cup)
  • 1 (15 ounce) can no-salt added diced tomatoes
  • 1 teaspoon Herbes de Provence
  • 4 cups low-sodium vegetable broth
  • 2 (15 ounce) cans white beans,rinsed and drained
  • 1/2 teaspoon kosher salt
  • 1/4 teaspoon black pepper
  • 1 teaspoon lemon zest
  • 4 ounces
Continue reading “Bean and Barley Leek Soup”

Potato Soup Slow Cooker Recipe

It’s cooked all day in the slow cooker and is great for a cold day. Top with bacon, cheese, and green onions for the ultimate potato soup. Prep Time: 10 mins, cook time: 5 hours

Ingredients

  • 1(80 oz.) bag frozen hash-brown potatoes (I used cubed)
  • 2 (14 0z.) cans chicken broth (see Note)
  • 1(10.75 oz.) can cream of chicken soup
  • 1/2 cup chopped onion
  • 1/4 teaspoon ground black pepper (more to taste)
  • 1 (80z) package cream cheese (softened)
  • Optional Toppings:
Continue reading “Potato Soup Slow Cooker Recipe”

Mama Stamberg’s Cranberry Relish

Ingredients

  • 2 cups whole raw cranberries, washed
  • 1 small onion
  • 3/4 cup sour cream
  • 1/2 cup sugar
  • 2 tablespoons horseradish from a jar (“red is a bit milder than white”)

Directions

  1. Grind the raw berries and onion together. (“I use an old-fashioned meat grinder,” says Stamberg. “I’m sure there’s a setting on the food processor that will give you a chunky grind — not a puree.”)
  2. Add everything else and mix.
  3. Put in a plastic container and freeze.
  4. Early Thanksgiving
Continue reading “Mama Stamberg’s Cranberry Relish”