branch prefix | desc | touches prod code |
---|---|---|
+:refs/heads/(feature/*) | add new feature | Y |
+:refs/heads/(fix/), +:refs/heads/(hotfix/) | bug fix | Y |
+:refs/heads/(refactor/*) | change code.e.g. renaming a variable | Y |
+:refs/heads/(docs/*) | changes to docs | N |
+:refs/heads/(style/*) | formatting, missing semi colons | N |
+:refs/heads/(test/*) | adding missing tests, refactoring tests | N |
+:refs/heads/(chore/*) | updating build scripts | N |
It's preferable to create an Axios instance in node.js. Why? Because it offers several advantages over using Axios directly. It provides a more flexible, organized, and maintainable way to manage HTTP requests:
When you create an instance, you can set default configurations like base URL, headers, timeouts, etc., that will be applied to all requests made using that instance. This eliminates the need to specify these settings for each request.
Reasons why workflows should be grouped into multiple AWS Logic Apps in order to help improve the development and maintenance lifecycle of workflows.
Grouping workflows by related business process helps you implement, test and deploy a logic app without impacting other logic apps.
In the example above there are three Logic App Standard apps - Orders, Shipment Notification, Overnight Batches - each one with multiple logic app workflows that are used to fulfil a specific business process.
Organizing the logic apps this way, allows changes in the Orders Logic App Standard app to be implemented, tested, and deployed without having any impact on Shipment Notification or Overnight Batches.
- Use concurrency for I/O bound calls (e.g. REST API calls)
- Use parallelizm for CPU bound calls
You're working on a python 3.X codebase. You have a service that has 1,000 TODO IDs. For each TODO IDs, you want to get the TODO details via https://jsonplaceholder.typicode.com/todos/{tod_id}
. How should you fan out the 1,000 calls to the TODO details web api? Which one of these techniques should you use? Either:
Your Powerlevel10k prompt might not be showing your Python virtual environment because it's configured to display the more informative name of the Python virtual environment. By default, Powerlevel10k may display the name of the directory containing the Python virtual environment rather than the less informative name "venv". This is more useful because it tells you which Python virtual environment is active rather than simply that a Python virtual environment is active.
However, you can change this configuration if you want. If you'd like your prompt to display "venv" when a Python virtual environment is active, you can add the following line to your ~/.p10k.zsh file:
typeset -g POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES=()
This will configure Powerlevel10k to display the less meaningful "venv" when a Python virtual environment is active. Please note that this will make your prompt less informative, which is w
How to store data within the request context using ThreadLocal (java), AsyncLocalStorage (node.js) vs contextvars (python)
Java's ThreadLocal
- ThreadLocal is a class in Java that allows you to create variables that can only be read and written by the same thread. Even if two threads are executing the same code, and the code has a reference to a ThreadLocal variable, then the two threads can't see each other's ThreadLocal variables. So, it's a form of thread confinement which is useful for preventing thread-safety issues.
- The primary limitation of ThreadLocal is that it is specifically tied to thread-based parallelism, so it's not as useful in event-driven or asynchronous programming models.
Python's contextvars
- The contextvars module in Python 3.7+ provides a way to manage context-specific variables in a way that is more flexible than ThreadLocal, and specifically designed to work well with asynchronous tasks. The ContextVar class represents a variable that has different values depending on t
#include "thingProperties.h" | |
// M5Unit-ENV - Version: 0.0.6 | |
#include <M5_ENV.h> | |
SHT3X sht30; | |
void setup() { | |
Wire.begin(); // Wire init, adding the I2C bus. |
class Logger { | |
public error(msg: string, exception: Error): void { | |
console.error(msg, exception); | |
} | |
} | |
const instance = new Logger(); | |
// Prevent modification to properties and values of the object. |
// I was getting this error when publishing sns from my local laptop: | |
// arn:aws:sns:ap-southeast-2:396497070286:int-afl-sns-topic | |
// Inaccessible host: `sns.ap-southeast-2.amazonaws.com'. | |
// This service may not be available in the `ap-southeast-2' region.", | |
// "code":"UnknownEndpoint", | |
// "region":"ap-southeast-2", | |
// "hostname":"sns.ap-southeast-2.amazonaws.com" | |
// getaddrinfo ENOTFOUND sns.ap-southeast-2.amazonaws.com | |
// This is the solution |