note-to-self://hans.anderson

Posts helping me remember how to do something I don't do often enough to remember. Or, that have enough steps in a particular order that I need to remember. Hopefully, they may help you, too.

April 28, 2025

How to Intercept Sockets Using Playwright

Intercept sockets using playwright with dev console trick.

Read

April 28, 2025

Kubernetes CoreDNS Notes

Some notes to help me remember some Kubernetes items: Core DNS handles all of the DNS internally. If it's not in CoreDNS then it checks the external network. ClusterIP means it's only accessible...

Read

April 28, 2025

Run Owasp Zap in a Docker container

Run as daemon mode: Desktop UI: Then go to http://localhost:8080/zap. Use https://host.docker.internal to hit https://local..com Baseline scan: Full scan: Find container's IP: Use...

Read

April 23, 2025

Writing to stdout/stderr in Docker / Kubernetes

Recently I was testing some log aggregation, and I needed to write data to stdout/stderr so that the logging agent could send them to the aggregator. Here's a snippet of code to run that for awhile...

Read

April 23, 2025

Check Whether an AWS VPC is Being Used

If you need to check whether a VPC is being used -- you do not want to delete a VPC if it is being used, you can double-check it with this command:

Read

March 10, 2025

Ippsec's nmap command

YouTube star ippsec's favorite nmap for initial recon:

Read

March 10, 2025

Cloudflare API Example in bash/curl

Cloudflare API Example in bash/curl. This particular script was a proof-of-concept to disable a cache rule.

Read

February 3, 2025

Git Config Backup

Read

January 25, 2025

ARP in Networking

ARP (Address Resolution Protocol) is a fundamental networking protocol. It translates IP addresses into their corresponding MAC address. Find your network interface: ifconfig...

Read

January 19, 2025

Promises in Three Languages

Three ways to handle concurrent API requests that resolve when all are done, but can run concurrently. In other words, if you have three requests and takes 2 seconds, takes 1 second takes 2...

Read

January 19, 2025

Concurrency vs Parallelism

As always: This is for my own understanding. Please don't assume it is 100% correct. Concurrency is handling multiple tasks during the same time. Parallelism is actually doing tasks at the same...

Read

January 18, 2025

Things to Know About Concurrency

Things to know about Concurrency: Why it's important: Devops involves working with systems that might involve multiple processes, threads, or containers running concurrently. Understanding basic...

Read

January 18, 2025

The `awk` Command

To determine whether a website is using only IPv6 or if it supports both IPv4 and IPv6 (dual stack), you can do: If only the IPv6 ping is successful, the site might not support IPv4. If...

Read

January 17, 2025

Bring a Git Subfolder and History to New Repo

Bring a git subfolder and it's history over to start a new repo: https://docs.github.com/en/get-started/using-git/splitting-a-subfolder-out-into-a-new-repository I did this for a repo and it was...

Read

January 12, 2025

Wireshark

Here's some notes on Wireshark, especially filtering results. You need to set an environment variable in a terminal, AND open the browser from that terminal: Then, you need to tell Wireshark...

Read

December 29, 2024

Kubernetes ConfigMap Values

Extract a Specific Key from a ConfigMap: You can use jq or yq to parse JSON or YAML output to get specific values. For example, to get the value of a specific key in a...

Read

December 21, 2024

Command to Find a Command's Shared Libraries

Command to find out what shared libraries an executable needs: ldd /bin/bash eg When I created a chroot test, I copied /bin/bash and then did the ldd, and it was not...

Read

December 21, 2024

Command to Find a Command's Apt Package

Sometimes I type a command in linux and it's not found. I try to install it and it's not found. Often it will say what package you need to install, but when it doesn't it's usually something...

Read

December 21, 2024

Python Instance Types

Python's gettype or instanceof is isinstance(). isinstance() can be used to check for a variety of object types in Python. Here are some common...

Read

December 21, 2024

Endianness and Hex Editor Values

Type "foobar" (no quotes) into a text file, open in a hex editor. 'b' will be hex '62' which translated to dec is '98', which is the ascii code for the letter 'b'. B's ascii code is 66, so the hex...

Read

December 21, 2024

Signal Handling in Three Languages

Signal processing in three scripting languages: Run: Run: Run:

Read

December 21, 2024

Hexidecimal Math

Note: this is not the "word" abc123. This is the number abc123 as represented in hexidecimal. Each "place" is 16^<place>. So abc123: a...

Read

December 7, 2024

Docker RUN v ADD v COPY

I was wondering why we needed specific commands like COPY, instead of just RUN cp file1 file2. Research, and a colleague, says there are two reasons: Basically,...

Read

December 7, 2024

Docker Image Layers

Each instruction in a Dockerfile (like RUN, COPY, or ADD) creates a new layer. These layers are stacked on top of each other to form a complete...

Read

December 7, 2024

Docker RUN v CMD v ENTRYPOINT

RUN - (buildtime) during image build, lines in a bash script to install everything for the image. Most Dockerfiles will have many of these. Each one creates a docker layer. It's a good idea to...

Read

December 3, 2024

Kubernetes Control Plane

Control Plane is a group of components to run the cluster; Data Plane is everything that is actually the app and things supporting the app. It's like the Control Plane is the OS and the Data Plane is...

Read

November 23, 2024

Add a Kubernetes Cluster Context

This is for my own understanding. Please don't assume it is 100% correct. Each cluster provider will have some sort of kubeconfig command so you can add a context locally, for whatever...

Read

November 23, 2024

View Your Current a Kubernetes `kubectl` Cluster Context on the CLI

When I first started using git many years ago, you would be working pretty blind on the command line (and I don't know of any GUI tools at the beginning). So, to make sure you didn't...

Read

November 23, 2024

VSCode keybindings.json file

My keybindings.json file, mostly for backup purposes: Note: on a Mac, these are in ~/Library/Application Support/Code/User/keybindings.json

Read

November 23, 2024

Install a Kubernetes Ingress

This is for my own understanding. It might be wrong but reflects my current understanding. (using kind) This setup maps ports 80 and 443 from localhost to the ingress. It's like...

Read

November 23, 2024

My `.bashrc` backup

Just a backup for my own sake.

Read

November 23, 2024

Difference Between Kubernetes yaml and Helm Chart

This is for my own understanding. Please don't assume it is 100% correct. A helm chart is an abstraction that allows you to group multiple k8s configuration files into one package and deploy...

Read

November 23, 2024

Kubernetes Helm Releases

This is for my own understanding. Please don't assume it is 100% correct. When releasing with helm, the release name typically stays the same when you then upgrade a Helm chart. The release name...

Read

November 23, 2024

Configuration backup for `~/.tmux.conf`

Plugins TPM Plugin Manager

Read

November 14, 2024

Kubernetes `Rollout`

In k8s, you don't "deploy", you "rollout". But, you don't "rollout" either. You either apply a deployment (or do it through helm, preferably), or kubectl create deployment <name>....

Read

November 13, 2024

Kubernetes Scaling

CA - Cluster Autoscaling. VPA - Vertical Pod Autoscaling. HPA - Horizontal Pod Autoscaling. To me, using VPA/HPA alone can’t be much cost savings. At best, it can rearrange the resources you are...

Read

November 13, 2024

Kubernetes Helm Basics

This is for my own understanding. It might be wrong but reflects my current understanding. Helm is a package manager and templater. It stores whatever info it has about the configuration in the...

Read

November 13, 2024

Kubernetes Cluster Management

This reflects how I currently understand this, and may be incorrect: kops: create k8s clusters that you manage yourself, on whatever provider (AWS, Azure, etc) eksctl: create k8s clusters managed...

Read

November 6, 2024

How to Find What Resource to List for `kind:`

When creating an application in kubernetes, there are a lot of values for the kind: field. This is how to find those, and explain them so you know what values should be there. Example:...

Read

November 4, 2024

VSCode *.code-workspace file

An example of a <something>.code-workspace file, mostly for backup purposes:

Read

October 31, 2024

VSCode settings.json file

My settings.json file as of 2024-10-31, mostly for backup purposes: Note: on a Mac, these are in ~/Library/Application Support/Code/User/settings.json

Read

October 31, 2024

VSCode Tips and Snippet

Open any compatible file: To open a file that isn't in a workspace into a new window instead. I like this when it's just a random file I want to edit, not part of a project.

Read

October 30, 2024

The `awk` Command

Has some crossover abilities but really shines with displaying or translating column data. Example usage: Find something in a file, then display the first two columns: Output data in a more...

Read

October 25, 2024

Kubernetes Namespace v Context

This SO answer really helped. Essentially, a context is just a way to set the namespace on the client side when running kubectl so that you don't have to type out the namespace part of...

Read

October 25, 2024

Why You Need an HPA for Every Container

HPA = Horizontal Pod Autoscaler. POD You need to configure resource request values for all of your containers in Kubernetes because HPA makes scaling decisions based on those values. It makes those...

Read

October 10, 2024

State Software Design Pattern

The State Design Pattern is a behavioral design pattern that allows an object to change its behavior when its internal state changes. This pattern is particularly useful when an object needs to...

Read

October 9, 2024

PHP Storm Ideavim File

Note: Need to restart PHP Storm after any change to take effect. I couldn't get the Action(<action>) syntax working but the :action <action> works fine....

Read

October 9, 2024

RBAC, ABAC, Roles & Permissions

Roles vs Permissions Set permissions to roles and assign roles to users. Don't assign permissions directly to users. Create a permission, like "can view page". Assign that permission to a role,...

Read

October 8, 2024

AWS Policy Elements

Some elements of an AWS policy include: SID (optional): Statement ID used to identify the purpose of the policy statement, especially with a policy with multiple statements. Version: There are only...

Read

October 8, 2024

Package Managers

Here’s a detailed table summarizing popular package managers and their key features, along with links to their official resources: Package Manager Software Ecosystem Versioning...

Read

October 7, 2024

Kubernetes Hierarchy

Hierarchy: Cluster (parent) --- Nodes Group (collection of machines) ----- Node (machines) ------- Pods (workload units on nodes) --------- Containers (running applications) Think of the Node as...

Read

September 29, 2024

Examples of Abstraction in the Real World

The reason we can even use things in this modern world is because of abstraction. No single person could know how everything we use on a daily basis works, much less how they were made in the first...

Read

May 25, 2024

xargs tips

XARGS things to remember xargs -p will show the command find . -name "foo" -print0 | xargs -0 (<<< print0 null, xarg uses null instead of space, in case file...

Read

May 24, 2024

Code Coverage VSCode With PHPUnit

Need: Get some code coverage up for unit tests in vscode. PHPUnit can handle outputting the necessary coverage information. Coverage Gutters can read the outputting coverage file (in xml). I'm...

Read

May 18, 2024

Redis client commands I want to remember

In laravel local, while devving vendor/bin/sail redis redis-cli (command, container, client) In forge/prod: Delete keys based on a part:

Read

May 18, 2024

SOLID Progamming Principles

The Principles: Single Responsibility - the class should do one thing and thus would only have one stakeholder with a reason to change it. A class that handles a report. Two things can change: the...

Read

May 18, 2024

Big O Notation

Used to analyze worst-case (usually) complexity to check resource requirements for runtime as inputs increase. Not about the hardware, etc. High level view. How long: time complexity. Memory...

Read

May 17, 2024

Brew (homebrew) commands and tips

Homebrew/brew MacOSX: Mac with M1/M3/M4: arch -arm64 brew install

Read

May 13, 2024

Mocking in Unit Tests

In testing a specific class, you mock it's dependencies to make sure that class calls the dependency correctly. Mock the dependency. shouldReceive - declare what should be called...

Read

April 30, 2024

Networking

In the subnet 192.168.1.0/30, the available addresses are as follows: CIDR Notation: /30 indicates that the first 30 bits of the IP address are the network portion, leaving 2 bits for...

Read

February 4, 2024

How to do an SQL Delete based on a Join

I'm mostly used to simple deletes using where clauses, but I know a DBA who prefers to use joins. To get more familiar, I've been doing simple stuff like that. The syntax between MS-SQL and MySQL is...

Read

February 1, 2024

A Simple PHP Benchmarking function

I recently needed to find where some performance issues were and didn't have the time to download and figure out any real-life tools, but this basic system helped. I could just sprinkle...

Read

January 31, 2024

MySQL - Find What Tables Have a Column Name

How to find out what tables in a MySQL database have a specific column, by name.

Read

January 17, 2024

How to Generate a Laravel API Token using Artisan Tinker

Generate a basic Laravel users.api_token:

Read

December 23, 2023

How to disable warning that MacOSX switched to zsh

To avoid this message: Add this to ~/.bashrc: From Stackoverflow

Read

December 21, 2023

Binary Math

Binary math is base 2. Our normal everyday numbering system is a base 10. Instead of 10 numbers (0-9), you can only have a value of 0 or 1. Take 00101101 = (0 * 2^7) + (0 * 2^6)...

Read

June 18, 2023

Reminder about PHP TS vs NTS

From PHP Documentation: Thread Safety means that binary can work in a multithreaded webserver context, such as Apache 2 on Windows. Thread Safety works by creating a local storage copy in each...

Read

May 7, 2023

Useful Git Snippets

Pull without going thru all the SSL self-signed BS but also not permanently overriding it. I used this a few times on a client network with a self-signed cert in the chain but no time to update the...

Read

March 17, 2023

Find, based on Time

GAME. CHANGER. newerBt is “birth time” where newerCt is “change time” which doesn’t find things being copied around. WOOHOO!!! (newermt!)...

Read

December 21, 2022

Bitwise Operators

If both binary numbers have a 1 in the same place, it's a 1. If one place has a 1 and one place has a 0, in & you keep the...

Read

December 8, 2022

Basic but Useful SSL Expiration Date checker

At an old job, every now and then we'd have a fire drill because, despite it being a large, capable organization, no one seems to track when an SSL cert expires. So, I created this little script to...

Read

November 18, 2022

Finding Your Public IP Address

How to find IP of my router (public IP). There is no way to do it with ifconfig, etc. That will only show local network stuff, and the internal network apparently doesn't know what it's public IP...

Read

October 30, 2022

Javascript Promises, Async and Await

As always: This is for my own understanding. Please don't assume it is 100% correct. await pauses the execution of an async function until the awaited promise resolves...

Read

February 27, 2022

Update Internet Information Server (IIS) Fast CGI Timeout

When debugging on Windows using Internet Information Server, if I took too long to step through what I was debugging, it would time out and I'd have to start over. Talk about anxiety! Lol. This...

Read

January 2, 2022

Quick and Dirty API endpoint testing using devtools console.

Sometimes I'd be on a client network, without access to tools like Postman. But, I'd want to test and endpoint to see what's what. So, a little hackery with the devtools console and I'm good:...

Read

December 21, 2021

Null and the Null Byte

The null keyword vs a null byte. They are not the same. Null Keyword: Represents the absence of a value. Used in various programming languages to indicate a variable has...

Read

August 17, 2021

Fix Git/Apache/Curl Self-Signed Cert issue

This is mainly a reminder to myself about how to do this, and the link to Matt Ferderer's website with the real instructions: Real Instructions Notes: Apache curl:...

Read

February 8, 2021

Install an SSL Cert in Apache

openssl pkcs12 -in domain.com.pfx -out domain.com.pem -nodes openssl rsa -in domain.com.pem -out domain.com.cert.key openssl x509 -in domain.com.pem -out domain.com.cert.crt Assuming copy those...

Read

February 8, 2021

SQL Snippets to Remember

Row Number Over: Find Duplicates: To determine if there is a duplicate:

Read

December 23, 2020

Setting up DNS for your AWS S3 static web site

Target Audience This post is aimed at relatively capable web/devops. People like me. I’m not going to remember everything, so I’ll probably re-read this myself in a few months or a year when I...

Read

December 23, 2020

Setting up an AWS S3 bucket for your static web site

Target Audience This post is aimed at relatively capable web/dev ops. People like me. I’ll probably re-read this myself in a few months or a year when I forget how to go about this. “Static...

Read

December 23, 2020

WordPress-to-static using wget mirror functionality and AWS S3

I like using WordPress. I’ve used it, AEM, Jekyll, a version of Laravel-as-CMS (currently Jigsaw and a lot of custom built code (in the early days). I don’t like how WordPress seems to be a main...

Read

December 23, 2020

Note to Self - Using AWS Client’s S3 Sync

This is pretty easy to do. If you use homebrew on a mac, open a terminal and type: brew install awscli I’m assuming that you can to apt-get install awscli on Linux, as...

Read

April 30, 2020

Loosely Coupled

Examples of "Loosely Coupled" in the real world. Restaurant Kitchen: Think of a restaurant where chefs specialize in different types of cuisine (e.g., Italian, Chinese, Mexican). Each chef can...

Read

October 8, 2017

Horizontal v Vertical Scaling

Horizontal scaling = Adding more houses 🏠 🏠 🏠 (More servers or machines) Vertical scaling = Adding more rooms 🛏️ 🛏️ 🛏️ to existing houses (More resources like CPU or RAM to...

Read