2779. Maximum Beauty of an Array After Applying Operation

You are given a 0-indexed array nums and a non-negative integer k. In one operation, you can do the following: Choose an index i that hasn't been chosen before from the range [0, nums.length - 1]. Replace nums[i] with any integer from the range [nums[i] - k, nums[i] + k]. The beauty of the array is the length of the longest subsequence consisting of equal elements. Return the maximum possible beauty of the array nums after applying the operation any number of times. Note that you can apply the operation to each index only once. A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the order of the remaining elements.
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var maximumBeauty = function(nums, k) {
    // Sort the array in non-decreasing order
    nums.sort((e1, e2) => e1 - e2);

    // Initialize two pointers and a variable to store the maximum beauty
    let l = 0;
    let r = 0;
    let result = 0;

    // Use a sliding window approach to find the maximum length of subsequence
    while (r < nums.length) {
        // Check if the current window is valid
        if (nums[r] 

Fórmula para Converter numero em CELULAR no Google Sheets

="("&ESQUERDA(C33;2)&") "&EXT.TEXTO(C33;4;5)&"-"&DIREITA(C33;4)

Assembly in STM32

void gpiod_init(void);

void app_main(void){
    gpiod_init();

    while (1)
    {
        asm volatile (
            "LDR R0, =0x40020C14   \n" // GPIOD_ODR address
            "LDR R1, =0xF000       \n" // Value to set pins 12-15
            "STR R1, [R0]          \n" // Write to GPIOD_ODR
        );
        HAL_Delay(1000);
        asm volatile (
            "LDR R0, =0x40020C14   \n" // GPIOD_ODR address
            "MOV R1, #0            \n" // Value to clear pins 12-15
   

Usefull detach handler

/*
https://javascript.plainenglish.io/7-infamous-javascript-bugs-that-shook-the-internet-3cf8f8f76098
*/

// Proper event listener cleanup to prevent memory leaks
function attachEvent() {
  const btn = document.querySelector("#myButton");
  const handleClick = () => console.log("Button clicked!");
  btn.addEventListener("click", handleClick);

  // Return a function to remove the listener and free up memory
  return () => btn.removeEventListener("click", handleClick);
}
const detach

LDR STR

**LDR - Load to Register** ![](https://cdn.cacher.io/attachments/u/3np9xf7epfikg/efvFTUlA_IJ6r6rZiBwLEYHDNGEwyxlI/sqfb66jgi.png) Load the value of the variable from the data memory into a register __________________________________________________________________________________ **STR - Store Register** ![](https://cdn.cacher.io/attachments/u/3np9xf7epfikg/LaF4ifW4fGsm4a3GWbYV4giPorRiY1Gw/37azk3mwh.png) Store the value of this register back into the data memory
asm("LDR R5, [R1]");
asm("STR R3, [R1]");

Redis run commands from file

cat load5.redis | redis-cli -h MY_HOST_OR_IP -p 6379 -a "MY_PASS"

azure sql on docker mssql sqlserver

docker pull mcr.microsoft.com/azure-sql-edge
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=dockerStrongPwd123" -p 1433:1433 --name heineken-mssql -d mcr.microsoft.com/azure-sql-edge
source ~/.nvm/nvm.sh
nvm install 18
nvm use 18
npm install -g sql-cli
mssql -u sa -p dockerStrongPwd123
DROP DATABASE heinekenb2b;
CREATE DATABASE heinekenb2b;
ALTER DATABASE heinekenb2b SET READ_COMMITTED_SNAPSHOT ON;
ALTER DATABASE heinekenb2b SET ALLOW_SNAPSHOT_ISOLATION ON;
use heinekenb2b;
SET TRANSACTION 

pyqt:app只运行运行一个实例

import random
import socket
import threading
from typing import Callable

import rpyc


class RpycClient:
    def __init__(self, port: int, secret: str) -> None:
        self.port = port
        self.secret = secret

    def check_port(self, host, port):
        sock = None
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.settimeout(0.5)
            result = sock.connect_ex((host, port))
            return result == 0
        

Liquid, js, style - trusted-by show less

{{ 'section-multicolumn.css' | asset_url | stylesheet_tag }}
{% comment %}
<style>
.multicolumn {
  &-list{
    gap: 10px;
  }
  &.multicolumn--trusted {
    --grid-desktop-horizontal-spacing: 0;
    --grid-desktop-vertical-spacing: 10px;

    .multicolumn-card {
      --text-boxes-radius: 8px;
      --text-boxes-border-width: 1px;
      --color-foreground: var(--main-color-foreground);
      --text-boxes-border-opacity: 0.20;

      height: 100%;
      border-radius: 8px;
   

rpyc调用封装测试

import random
import socket
import threading
from typing import Callable

import rpyc


class RpycClient:
    def __init__(self, port: int, secret: str) -> None:
        self.port = port
        self.secret = secret

    def check_port(self, host, port):
        sock = None
        try:
            sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            sock.settimeout(0.5)
            result = sock.connect_ex((host, port))
            return result == 0
        

JS - anchorLinks

const anchorLinks = document.querySelectorAll('[href="#bundle-product"]');
// TODO refactore
if (anchorLinks) {
    anchorLinks.forEach(elem => {
        elem.addEventListener('click', function () {
            document.querySelector('[id="bundle-product"]').scrollIntoView({
                behavior: 'smooth'
            });
        })
    })
}

Install & List packages

##### CELL 1 #####
%%capture --no-stderr

# Installs
PACKAGES = [
    'google-cloud-firestore',
    'google-cloud-secret-manager',
    'langchain',
    'langchain-google-cloud-sql-mysql',
    'langchain-google-vertexai',
    'langchain-core',
    'langchain-community',
    'langgraph',
    'pymysql',
]
PACKAGES_STR = ' '.join(PACKAGES)

%pip install -U $PACKAGES_STR

##### CELL 2 #####
# Check versions
%pip freeze | grep -iE "$(echo {PACKAGES_STR} | tr ' ' '|')"

##### CELL 3 #####
# Also check 

mysql_agent

"""
Code relative to agent instanciation and answering
"""


from langchain.agents import create_sql_agent
from langchain.agents.agent_types import AgentType
from langchain_community.agent_toolkits import SQLDatabaseToolkit
from langchain_core.messages import HumanMessage, SystemMessage
from langchain_google_vertexai import ChatVertexAI


MULTIMODAL_MODEL = "gemini-1.5-flash"  # Light model to reduce costs

SQL_PREFIX = """You are an agent designed to interact with a SQL database.
Given an input

mysql_database

"""
Module devoted to instanciate an object for LangChain to interact with 
the MySQL database, hosted on Cloud SQL.
"""


from google.cloud import secretmanager
from langchain_google_cloud_sql_mysql import MySQLEngine
from langchain_community.utilities.sql_database import SQLDatabase
from sqlalchemy import create_engine


def instanciate_db(
    project_id: str, region: str, instance: str, database: str, user: str
) -> SQLDatabase:
    """
    Instanciate an object for LangChain to interact wit

Css - Text - dots

.text-line-dots {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}