Categories
Learning

Bitwarden subdomains

Context

I use Bitwarden as my password manager. It is open source, battle tested, and secure. But I realized recently that it doesn’t recognize a subdomain as a separate website to which I can login. One of the applications I use daily has many instances that are hosted on subdomains and each instance has its own username and password. When I need to access an instance, I have to navigate to the URL and then manually select the right option from a long list in my Bitwarden plugin for Brave to autofill my username and password. This got me thinking – I wonder if Bitwarden has an option to handle this situation.

Search terms

bitwarden subdomain

Helpful link

https://bitwarden.com/help/article/uri-match-detection/

Outcome

Turns out the Bitwarden team has solved this with a feature. By changing my default URI match detection option to “Host” I get the behavior I was hoping for. The plugin matches the right instance by subdomain and provides me a quick way to fill in my username and password.

Categories
Learning

Working folder for npm scripts

Context

I am setting up some scripts for using terraform to deploy a node project to AWS and when I execute the commands from the root folder, they do not work. They must be executed from the folder that contains the .tf files. But I am not sure how to do this in my package.json file. The scripts property looks like this:

"scripts": {
        "start": "node server.js",
        ...
        "deploy": "terraform apply" <-- must be run from subfolder
}

Search terms

npm scripts working directory

Helpful link

https://stackoverflow.com/questions/30286498/change-working-directory-for-npm-scripts

Outcome

Thanks to the answer provided by eljefedelrodeodeljefe, I learned that you simply have to include “cd FOLDER_NAME &&” before your script and this works across most platforms. So in my case, this looks like the following:

"scripts": {
        "start": "node server.js",
        ...
        "deploy": "cd infrastructure && terraform apply" <-- must be run from subfolder
}

One nice thing is that this approach is consistent with the syntax used in a Makefile for a Python project I have recently worked with.

Categories
Learning

Async Python Handlers in AWS Lambda

Context

I am creating my first AWS Lambda function in Python from scratch. My function contains async functions, so I declared my handler with the async keyword. But when I deployed and smoke tested in AWS, I received the following error:

{
"errorMessage": "Unable to marshal response: Object of type coroutine is not JSON serializable",
"errorType": "Runtime.MarshalError"
}

Search terms

aws lambda python async handler

Helpful link

https://stackoverflow.com/questions/60455830/can-you-have-an-async-handler-in-lambda-python-3-6

Outcome

Apparently AWS Lambda does not support async handler functions in Python. So you are required to call your asynchronous code from a synchronous handler function using this line of code:

asyncio.get_event_loop().run_until_complete(your_async_handler())

Categories
Learning

Google Calendar Drag and Drop

Context

My dad has a new phone since we recently switched back to Total Wireless from Sprint. It is another Android phone so most things are the same but there is one feature missing. He cannot drag and drop appointments on his Google calendar to different days or times.

Search terms

Google calendar app drag items

Helpful link

https://support.google.com/calendar/thread/850605?hl=en

Outcome

It turns out that disabling an accessibility feature called “Select to speak” resolved this issue.

Categories
Learning

Cholesterol Blood Testing

Context

My doctor informed me at my last annual physical that my good cholesterol is too low and my bad and total cholesterol are too high. I knew this from past tests but he urged me to take action to improve my levels. I also know that this is somewhat genetic because my vegetarian marathon running Dad also has the same problem.

My doctor recommended exercise and dietary changes. Though I have not increased my physical activity as much as I should, I did improve my diet. Based on a suggestion from a friend at church and with my doctor’s support, I also agreed to try a supplement called red yeast rice that has similar effects as prescription statins to see if that would help. This was about six months ago and I’m wondering how often it makes sense to test cholesterol levels in my blood.

Search terms

frequency of cholesterol blood tests

how long does it take for cholesterol to change

Helpful link

https://www.healthline.com/health/high-cholesterol/how-long-does-it-take-to-lower

Outcome

My first search only returned articles recommending testing every five years or in certain cases annually, or as prescribed by a doctor. But I wanted to know how often I can test to see improvement based on dietary and supplement changes. So I was more specific in my second search. The answer was in line with my doctor’s suggestion.

I learned that taking this test as often as three to six months makes sense to see if changes have had the desired effect, so I have a blood test scheduled for this week.

I also learned that you can order this kind of routine blood test directly from companies like Sonora Quest without having to go through your physician or insurance and it is very affordable ($28).

Categories
Learning

Constructing Javascript Objects

Context

I am building a simple model class in Typescript/Javascript and was wondering if there was a shorthand way to avoid having to explicitly set each property name based on the constructor arguments.

Search terms

javascript constructor properties shorthand

Helpful link

https://maksimivanov.com/posts/typescript-constructor-shorthand/

Outcome

I found exactly what I was looking for. This is a Typescript feature only, so it wouldn’t work in pure Javascript, but it is much easier to type:

class Something {
  constructor(public prop1: string, public prop2: string) {}
}

than to type:

class Something {
  public prop1: string;
  public prop2: string;
  constructor(prop1: string, prop2: string) {
    this.prop1 = prop1;
    this.prop2 = prop2;
  }
}

Both produce the same Javascript in the end.

Categories
Learning

Creating Subfolders

Context

I need to provide instructions in a project on which folders and subfolders need to exist before the code will run locally. The required folder is three levels deep, and I want a quick way to create the full directory tree.

Search terms

mkdir subfolders

Helpful link

https://stackoverflow.com/questions/9242163/bash-mkdir-and-subfolders

Outcome

I learned that the mkdir command in a bash terminal includes option “-p” to create all necessary parent folders for a full path in one command.

Categories
Learning

Table metadata in Oracle

Context

Normally I work in SQL Server when I am dealing with relational data but on my current project one of our primary systems uses Oracle as its back end. In order to quickly generate a list of column names for use in an access request, I need to interrogate the table metadata and I cannot recall the way to do this on Oracle.

Search terms

oracle column list query

Helpful link

https://dataedo.com/kb/query/oracle/list-columns-names-in-specific-table

Outcome

I was reminded to use sys.all_tab_columns to get this information.

Categories
Learning

Multidomain SSL Certificates

Context

As I relaunch my website and blog, I want to make it secure. But I host two different domains on this same site (with a host-based redirect), so I wanted to make sure I could secure both of them. My host’s support team told me I would need to use their “Certificate Signing Request” (CSR) to install an SSL cert but this requires a single common name for the domain name. My question was – how do I generate a CSR for multiple domains?

Search terms

csr for multidomain certificate

Helpful link

https://www.namecheap.com/support/knowledgebase/article.aspx/9840/67/how-do-i-activate-a-multidomain-ssl-certificate

Outcome

According to this article, I can use my primary domain in the CSR and add additional domains (SANs) when activating the certificate.

Categories
Learning

Introduction

When I Google stuff with Bing on my Brave browser, that is usually a moment of learning in my life, so I thought I would catalog those moments here.

Template —

Context

What I was working on or thinking about before performing a search.

Search terms

What words I used in my search.

Helpful link

The link I chose that was most helpful.

Outcome

What I learned and how I applied it.