interesting tidbits

Things I've discovered while roaming through the jungle of technology

Here's the recipe to generate your favorite 2FA token without taking your hands off your keyboard.

Step 1

Store your login credentials and 2FA secret in a password manager like Bitwarden. https://bitwarden.com/help/password-manager-overview/

Step 2

Install Bitwarden CLI. https://bitwarden.com/help/cli/

Step 3

Login using bw login command and then export your Bitwarden Session Key BW_SESSION to an in-memory environment variable.

Step 4

Fetch the id of the record for which you want the 2FA token.

bw get item <credential name>

Step 5

Add the below lines to your .bashrc or .zshrc.

alias cp2fatoken="bw get totp <id from step 4> | pbcopy"

Step 6

Use cp2fatoken

Use this to track scheduled job failures. It helps to reduce alert fatigue by alerting only when a job fails.

https://deadmanssnitch.com/

EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles.

EditorConfig files are easily readable and they work nicely with version control systems.

https://editorconfig.org/

https://cloud.google.com/architecture/devops/devops-tech-trunk-based-development

Trunk-based development is a required practice for continuous integration.

Continuous integration (CI) is the combination of practicing trunk-based development and maintaining a suite of fast automated tests that run after each commit to trunk to make sure the system is always working.

Analysis shows that teams achieve higher levels of software delivery and operational performance (delivery speed, stability, and availability) if they follow these practices -

  • Have three or fewer active branches in the application's code repository.
  • Merge branches to trunk at least once a day.
  • Don't have code freezes and don't have integration phases.

More reading -

Multiplexing is the ability to send more than one signal over a single line or connection. In OpenSSH, multiplexing can re-use an existing outgoing TCP connection for multiple concurrent SSH sessions to a remote SSH server, avoiding the overhead of creating a new TCP connection and reauthenticating each time.

Add this to the top of your ~/.ssh/config file

Host *
  ControlPath ~/.ssh/control-%h-%p-%r
  ControlMaster auto

Reading material - https://www.simplified.guide/ssh/share-connection-with-multiplexing https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing https://blog.scottlowe.org/2015/12/11/using-ssh-multiplexing/

PS: You only need to authenticate using 2FA for the first session. All subsequent connections re-use the TCP connection established in the first session.