How to quit Amazon

I have considered quitting Amazon over the past few years, however Jeff Bezos recently kowtowing to Trump was the last straw.

Will it end up costing me more money to purchase some items and will it take longer for me to get them? For sure, but I am willing to live with that.

The first thing that I wanted to do was to get my purchase history. Often time, I will search through it to remember something that I bought → Continue reading “How to quit Amazon”

My jq cheat sheet

jq is pure awesomeness. If every you want to “grep” through JSON data on the command line, this is the tool for you. Unfortunately, I don’t use it everyday, so when I do go to use it I forget the details for doing some basic operations.

Sample Data

[
    {
        "name": "Homer Simpson",
        "occupation": "Nuclear Safety Inspector"
    },
    {
        "name": "Marge Simpson",
        "occupation": "Mayor"
    },
    {
        "name": "Milhouse Van Houten",
        "occupation": "Student"
    },
    {
        "name": "Homeboy Van Somebody",
        "occupation": "Lawyer"
    
Continue reading “My jq cheat sheet”

Vegetarian Shepherd’s Pie

This is a recipe by Samantha Seneviratne.

Ingredients

Topping

  • 2 tablespoons kosher salt
  • 2 pounds russet potatoes, peeled and quartered (about 3 large)
  • 6 tablespoons unsalted butter
  • 1/2 cup whole milk
  • 1/2 cup sour cream
  • 1/2 cup packed grated Parmigiano-Reggiano cheese or vegetarian Parmesan (optional)
  • Freshly ground black pepper

Filling

  • 3/4 cup French lentils
  • 4 sprigs thyme
  • 3 1/2 cups vegetable broth
  • 1 teaspoon kosher salt
  • 4 tablespoons butter
  • 8 ounces sliced mixed mushrooms, such as button, cremlnl and
Continue reading “Vegetarian Shepherd’s Pie”

Debian Package Management Cheat Sheet

  • List version of an installed package: dpkg -s docker-ce | grep Version
  • Show all available versions of a package: apt-cache madison <package>

Packages being held back because of phasing

Run the following command replacing the package in question

apt-get --with-new-pkgs upgrade <package-name

The following packages have been kept back

Try the following, in order. Each is less risky than the next. Stop as soon as you have fixed the problem.

Solution 1

apt-get --with-new-pkgs upgrade <list of packages kept back
Continue reading “Debian Package Management Cheat Sheet”

How to partially cherry-pick a commit in git

There are times when you need to cherry-pick a commit from another branch. Then there are times when you only need parts of that commit.

Following is how you can partly cherry-pick a commit to get only the changes that you need.

Get the patch for the entire commit. Include the -n for no commit so that it does not add it as a commit to your branch

git cherry-pick -n <commit

Then unstage the the changes from the cherry-picked → Continue reading “How to partially cherry-pick a commit in git”

Pancakes

Ingredients

  • 1 1/2 cups all-purpose flour
  • 3 1/2 teaspoons baking powder
  • 1 teaspoon salt
  • 1 tablespoon of honey
  • 2 cups milk
  • 1 egg
  • 3 tablespoons butter, melted

Directions

  1. In a large bowl, sift together the flour, baking powder, and salt.
  2. In a separate bowl, lightly whip the eggs and then add the milk, egg, and honey and mix
  3. Pour the wet mixture into the dry and mix until smooth.
  4. Heat a lightly oiled griddle or frying pan over medium high
Continue reading “Pancakes”

Banana Bread

If you wait until your bananas are sufficiently over-ripe they will have enough sugar that you don’t have to add much at all and it makes for a much healthier bread.

You can make a double batch, cut up and freeze and it will stay fresh a very long time. Simply remove a piece from the freezer and microwave on high for 45 seconds to a minute and it will taste like it just came out of the oven.

Ingredients

Continue reading “Banana Bread”

Go template that properly renders delimiters for a slice of structs

It is common to write go text/templates that range over a slice of objects to write out a list or array of items that are separated by some delimiter defined in the template.

In the case of a JSON array of objects, the cleanest output would be a , separating each object without a leading or trailing comma.

Because go template if statements are falsey in that a 0 value will evaluate to false you can write a template as → Continue reading “Go template that properly renders delimiters for a slice of structs”

Query nested arrays in PostgreSQL JSON data

The following is an example showing how to query multiple nested arrays in JSON data in a PostgreSQL database.

Given

CREATE TABLE sample_json (
  id serial PRIMARY KEY,
  name varchar(64),
  json_data json
);


INSERT INTO sample_json (name, json_data)
VALUES
	(
	'NA',
	'
	{
	    "location": "US",
	    "topLevelArray": [
	        {
	            "id": 1,
	            "secondLevelArray": [
	                {
	                    "key": "someKey",
	                    "operator": "=",
	                    "value": 10
	                },
	                {
	                    "key": "foo",
	                    "operator": ">=",
	                    "value": 5
	                },
	                {
	                    "key": "someOtherKey",
	                    "operator": ">",
	                    "value": 647
	                }
	            ]
	        },
	        {
	            "id": 
Continue reading “Query nested arrays in PostgreSQL JSON data”

Chili Garlic Tofu with Broccoli

Ingredients

  • 2 14 oz packages of extra firm tofu
  • 2 TB olive oil
  • Salt & pepper, to taste
  • 4 garlic cloves, minced
  • 1 lb. broccoli florets
  • 2 TB Sambal Olek or chili paste
  • 4 TB honey
  • 1 TB low sodium soy sauce
  • 4 sheets roasted seaweed
  • 1 TB sesame seeds
  • 1.5 cups basmati rice

Directions

  1. Blot tofu with paper towels while pressing down slightly to release water. Slice into 1/2 inch thick pieces and blot again with paper towels.
  2. Sauce:
Continue reading “Chili Garlic Tofu with Broccoli”