GCP-Useful commands

# GCP Useful Commands

## CLI

### Buckets

* List all files: `gcloud storage ls gs://your-bucket-name`

Python_TD_General

# PYTHON & PATH

## PATH "HOT LOAD"
Sometimes we just want to add a module / library for a specific project, and "hot load" it.
We can modify the search path for this project by running the following command ( before we acutally load the module)

Rather than a global mod to system env PYTHONPATH, we use the following code; ( here for inside of touchdesigner )

Firing an Execute DAT onStart() with the code snippet below:


### example execute dat in TD.
```
import sys
mypath = "C:/Python311/Lib/s

3783. Mirror Distance of an Integer

You are given an integer n. Define its mirror distance as: abs(n - reverse(n))​​​​​​​ where reverse(n) is the integer formed by reversing the digits of n. Return an integer denoting the mirror distance of n​​​​​​​. abs(x) denotes the absolute value of x.
/**
 * @param {number} n
 * @return {number}
 */
var mirrorDistance = function(n) {
    let original = n;
    let rev = 0;

    // Reverse the digits of n
    while (n > 0) {
        rev = rev * 10 + (n % 10);
        n = Math.floor(n / 10);
    }

    // Mirror distance = |n - reverse(n)|
    return Math.abs(original - rev);
};

3761. Minimum Absolute Distance Between Mirror Pairs

You are given an integer array nums. A mirror pair is a pair of indices (i, j) such that: 0 <= i < j < nums.length, and reverse(nums[i]) == nums[j], where reverse(x) denotes the integer formed by reversing the digits of x. Leading zeros are omitted after reversing, for example reverse(120) = 21. Return the minimum absolute distance between the indices of any mirror pair. The absolute distance between indices i and j is abs(i - j). If no mirror pair exists, return -1.
/**
 * @param {number[]} nums
 * @return {number}
 */
var minMirrorPairDistance = function(nums) {
    const last = new Map();     // value -> most recent index of reverse(nums[i])
    let ans = Infinity;

    function rev(x) {
        let r = 0;
        while (x > 0) {
            r = r * 10 + (x % 10);
            x = Math.floor(x / 10);
        }
        return r;
    }

    for (let i = 0; i < nums.length; i++) {
        const x = nums[i];

        // If we've seen a reversed partner before,

Gitlab repo empty

# Command line instructions

You can also upload existing files from your computer using the instructions below.

## Configure your Git identity

Get started with Git and learn how to configure it.

## Git local setup

Configure your Git identity locally to use it only for this project:

```
git config --local user.name "Xuan NGUYEN"
git config --local user.email "xuxu.fr@gmail.com"
```

## Add files

Push files to this repository using SSH or HTTPS. If you're unsure, we recom

C1 U20

tight deadline
Make amendments = make changes
from around the world
buyer's remorse
work laptop

H
man made forest
avocado stones
electronic waste
lanfill sides
leftover food
lower-income
famine

I
doom and gloom
heading from
baked by
taking off
killing two birds with one stone
drive down

3488. Closest Equal Element Queries

You are given a circular array nums and an array queries. For each query i, you have to find the following: The minimum distance between the element at index queries[i] and any other index j in the circular array, where nums[j] == nums[queries[i]]. If no such index exists, the answer for that query should be -1. Return an array answer of the same size as queries, where answer[i] represents the result for query i.
/**
 * @param {number[]} nums
 * @param {number[]} queries
 * @return {number[]}
 */
var solveQueries = function(nums, queries) {
    const n = nums.length;
    const last = new Map();
    const dp = new Array(n).fill(n); // n = "no match yet"

    // Walk through array twice to simulate circular behavior
    for (let i = 0; i < 2 * n; i++) {
        const idx = i % n;
        const num = nums[idx];

        if (last.has(num)) {
            const prev = last.get(num);
            const dist = i 

Data Wrangling

Pandas support page: http://pandas.pydata.org/

Acess a specific column
  df["column"]
  
Drop missing values
  df.dropna(subset=["column"], axis=0, inplace = True)
  
Replave missing values
  df["missing_value"].replace(np.nan, new_value)
    ex.mean_of_table = df["loses"].mean()
      df["loses"].replace(np.nan, mean)

Identify types
  df.dtype()
  
Convert one dataframe to another type
  df.astype()
    ex. df["price"] = df["price"].astype("int")

Normailze datatypes
  Simple  feature scaling

2515. Shortest Distance to Target String in a Circular Array

You are given a 0-indexed circular string array words and a string target. A circular array means that the array's end connects to the array's beginning. Formally, the next element of words[i] is words[(i + 1) % n] and the previous element of words[i] is words[(i - 1 + n) % n], where n is the length of words. Starting from startIndex, you can move to either the next word or the previous word with 1 step at a time. Return the shortest distance needed to reach the string target. If the string target does not exist in words, return -1.
/**
 * @param {string[]} words
 * @param {string} target
 * @param {number} startIndex
 * @return {number}
 */
var closestTarget = function(words, target, startIndex) {
    const n = words.length;

    // We'll track the smallest circular distance found.
    // Start with Infinity so any real distance will be smaller.
    let best = Infinity;

    // Check every index in the array.
    for (let i = 0; i < n; i++) {

        // Only consider positions where the word matches the target.
        if

Prevent to commit on branches

- Create `.git/hooks/pre-commit` file - Then make it executable with `chmod +x .git/hooks/pre-commit`
#!/bin/bash
protected_branches="^(develop|main|master|production|staging)$"
current_branch=$(git symbolic-ref --short HEAD 2>/dev/null)

if [[ "$current_branch" =~ $protected_branches ]]; then
    echo "🚫 Direct commits to '$current_branch' are not allowed."
    echo "   Please switch to a feature branch:"
    echo "     git checkout -b feature/your-change"
    exit 1
fi
exit 0

JS - who adds inline styles

(function() {
    // Ищем inline-style с display:block и opacity:1!important
    // Допускаем пробелы, необязательные ; и любой дополнительный мусор вокруг
    const sniperRegex = /display\s*:\s*block\s*;[\s\S]*opacity\s*:\s*1\s*!important\s*;?|opacity\s*:\s*1\s*!important\s*;[\s\S]*display\s*:\s*block\s*;?/i;

    function logTrap(methodName, content, element) {
      console.debug('------------------------>>>> START <<<<------------------------');
      console.debug('----->>>> ', {
  

AWSでのwebアプリケーション構成パターン

# AWS Webアプリケーション インフラ構築パターン

## 目次

1. [パターン一覧](#パターン一覧)
2. [パターン1: EC2単体構成](#パターン1-ec2単体構成)
3. [パターン2: EC2 + RDS構成](#パターン2-ec2--rds構成)
4. [パターン3: ALB + Auto Scaling + RDS構成](#パターン3-alb--auto-scaling--rds構成)
5. [パターン4: ECS Fargate構成](#パターン4-ecs-fargate構成)
6. [パターン5: EKS構成](#パターン5-eks構成)
7. [パターン6: サーバーレス構成](#パターン6-サーバーレス構成)
8. [パターン7: 静的サイト + API構成](#パターン7-静的サイト--api構成)
9. [パターン8: Amplify構成](#パターン8-amplify構成)
10. [パターン9: マイクロサービス構成](#パターン9-マイクロサービス構成)
11. [パターン10: ハイブリッド構成](#パターン10-ハイブリッド構成)
12

wisper-clone

 can you help me create a tool simalar to wispr flow ,so i would like to have a wiget that will pop up or be opened
with a combiation of ketpresses(hotkeys), and the user clicks on a place on the page where they would like thier text
transcribed and then it happens as they are talking , if no place on the page is specified, then the transcription
needs to be saved to a place of the users choosing, default to documents. The coolish thing about wispr flow is that
ai will fix it on the fly so i

gsm mini test

#include <Arduino.h>

#define SIM800_RX 18
#define SIM800_TX 17

HardwareSerial simSerial(1);

String readResponse(unsigned long timeoutMs)
{
    String resp = "";
    unsigned long start = millis();

    while (millis() - start < timeoutMs)
    {
        while (simSerial.available())
            resp += (char)simSerial.read();
    }

    return resp;
}

void sendAT(const char *cmd, unsigned long waitMs = 1000)
{
    Serial.println("=================================");
  

fest12

void simTask(void *pvParameters)
{
    vTaskDelay(pdMS_TO_TICKS(6000));

    simSerial.begin(9600, SERIAL_8N1, SIM800_RX, SIM800_TX);
    vTaskDelay(pdMS_TO_TICKS(1000));

    simFlush();
    simSerial.println("AT");
    vTaskDelay(pdMS_TO_TICKS(300));
    simFlush();
    simSerial.println("ATE0");
    vTaskDelay(pdMS_TO_TICKS(300));

    simFlush();
    simSerial.println("AT+CPIN?");
    String cpinInit = simReadResponse(3000);
    Serial.println("[GSM] CPIN init: " + cpinInit)