3904. Smallest Stable Index II

You are given an integer array nums of length n and an integer k. For each index i, define its instability score as max(nums[0..i]) - min(nums[i..n - 1]). In other words: max(nums[0..i]) is the largest value among the elements from index 0 to index i. min(nums[i..n - 1]) is the smallest value among the elements from index i to index n - 1. An index i is called stable if its instability score is less than or equal to k. Return the smallest stable index. If no such index exists, return -1.
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var firstStableIndex = function(nums, k) {
    const n = nums.length;

    // Build suffix min
    const suffMin = Array(n);
    suffMin[n - 1] = nums[n - 1];
    for (let i = n - 2; i >= 0; i--) {
        suffMin[i] = Math.min(suffMin[i + 1], nums[i]);
    }

    let prefMax = -Infinity;

    for (let i = 0; i < n; i++) {
        prefMax = Math.max(prefMax, nums[i]);
        if (prefMax - suffMin[i] <= k) return i;
    }

3903. Smallest Stable Index I

You are given an integer array nums of length n and an integer k. For each index i, define its instability score as max(nums[0..i]) - min(nums[i..n - 1]). In other words: max(nums[0..i]) is the largest value among the elements from index 0 to index i. min(nums[i..n - 1]) is the smallest value among the elements from index i to index n - 1. An index i is called stable if its instability score is less than or equal to k. Return the smallest stable index. If no such index exists, return -1.
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var firstStableIndex = function(nums, k) {
    const n = nums.length;

    // Build prefix max
    const prefixMax = Array(n);
    prefixMax[0] = nums[0];
    for (let i = 1; i < n; i++) {
        prefixMax[i] = Math.max(prefixMax[i - 1], nums[i]);
    }

    // Build suffix min
    const suffixMin = Array(n);
    suffixMin[n - 1] = nums[n - 1];
    for (let i = n - 2; i >= 0; i--) {
        suffixMin[i] = Math.min(suffix

Pre render pages with blocks / templates

<?php
// Advantage of this approach is you can design visually in the editor first

function dlrg_filter_post_content( $content, $post ) {
	

	if ( $post->post_type === 'event' ):
	
	// -----
	$content ='';
	//------ 
	
	endif;
		
	return $content;
}
add_filter( 'default_content', 'dlrg_filter_post_content', 10, 2 );

3876. Construct Uniform Parity Array II

You are given an array nums1 of n distinct integers. You want to construct another array nums2 of length n such that the elements in nums2 are either all odd or all even. For each index i, you must choose exactly one of the following (in any order): nums2[i] = nums1[i] nums2[i] = nums1[i] - nums1[j], for an index j != i, such that nums1[i] - nums1[j] >= 1 Return true if it is possible to construct such an array, otherwise return false.
/**
 * @param {number[]} nums1
 * @return {boolean}
 */
var uniformArray = function(nums1) {
    nums1.sort((a, b) => a - b);

    let smallestOdd = null;
    let smallestEven = null;

    for (let x of nums1) {
        if (x % 2 === 1 && smallestOdd === null) smallestOdd = x;
        if (x % 2 === 0 && smallestEven === null) smallestEven = x;
    }

    // Check possibility of all-even
    let allEvenPossible = true;
    for (let x of nums1) {
        if (x % 2 === 1) {
            // odd needs

[Tips]

[Tips]
## How to use `basename`

Example: in case `active.conf`

> btw this is setting file of hyprland

```bash
basename "active.conf"
# => active.conf

basename "active.conf" ".conf"
# => active
```

## How to convert

### Term

- `source-extension`: extension you wanna convert from.
- `target-extension`: extension you wanna convert to.

### How to Write

```bash
cd "your-target-directory"
for file in "*.source-extension"; do mv "$file" "$(basename "$file" ".source-extension").target-extension"; done

3875. Construct Uniform Parity Array I

You are given an array nums1 of n distinct integers. You want to construct another array nums2 of length n such that the elements in nums2 are either all odd or all even. For each index i, you must choose exactly one of the following (in any order): nums2[i] = nums1[i] nums2[i] = nums1[i] - nums1[j], for an index j != i Return true if it is possible to construct such an array, otherwise, return false.
/**
 * @param {number[]} nums1
 * @return {boolean}
 */
var uniformArray = function(nums1) {
    // The problem allows us to transform each element by either:
    //   1) keeping nums1[i], or
    //   2) subtracting nums1[j] from it (j ≠ i)
    //
    // Because subtracting numbers can always produce either all-even
    // or all-odd results depending on what parity exists in the array,
    // it is ALWAYS possible to make the final array uniform in parity.
    //
    // Therefore the answer is 

[Tips] How to Resolve where script is located on Bash/Zsh

[Tips] How to Resolve where script is located on Bash/Zsh
```bash
dirname "$(readlink -f ~/.zshrc)
```

Revert last commit on remove and keep changed on another branch

On branch `branch_a`, after accidently committing and pushing to remote, here is how to revert the last commit, while keeping changes on another branch. Assuming that nobody else has contributed.
```bash
git switch branch_a
git status

# Optional safety pointer to the accidental commit
git branch backup/accidental-commit

# Remove the commit, keeping all its changes staged
git reset --soft HEAD~1

# Correct the remote branch
git push --force-with-lease origin branch_a

# Create the intended bran

ボタン ホバーで矢印アイコンが移動

<a href=""class="btn">
  <p>テキスト</p>
  <span class="btn__icon">
    <svg class="btn__icon--img" id="" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 14 14">
      <path d="M1.3,6.2c-.4,0-.8.3-.8.8s.3.8.8.8v-1.5h0ZM13.2,7.5c.3-.3.3-.8,0-1.1L8.4,1.7c-.3-.3-.8-.3-1.1,0-.3.3-.3.8,0,1.1l4.2,4.2-4.2,4.2c-.3.3-.3.8,0,1.1s.8.3,1.1,0c0,0,4.8-4.8,4.8-4.8ZM1.3,6.9v.9h11.3v-1.6H1.3v.9-.2Z"/>
    </svg>
</a>

3568. Minimum Moves to Clean the Classroom

You are given an m x n grid classroom where a student volunteer is tasked with cleaning up litter scattered around the room. Each cell in the grid is one of the following: 'S': Starting position of the student 'L': Litter that must be collected (once collected, the cell becomes empty) 'R': Reset area that restores the student's energy to full capacity, regardless of their current energy level (can be used multiple times) 'X': Obstacle the student cannot pass through '.': Empty space You are also given an integer energy, representing the student's maximum energy capacity. The student starts with this energy from the starting position 'S'. Each move to an adjacent cell (up, down, left, or right) costs 1 unit of energy. If the energy reaches 0, the student can only continue if they are on a reset area 'R', which resets the energy to its maximum capacity energy. Return the minimum number of moves required to collect all litter items, or -1 if it's impossible.
/**
 * @param {string[]} classroom
 * @param {number} energy
 * @return {number}
 */
var minMoves = function(classroom, energy) {
    const m = classroom.length;
    const n = classroom[0].length;

    let start = null;
    const litters = [];

    // Find S and all L
    for (let i = 0; i < m; i++) {
        for (let j = 0; j < n; j++) {
            const c = classroom[i][j];
            if (c === 'S') start = [i, j];
            if (c === 'L') litters.push([i, j]);
        }
    }

    const L

Extract team id and simulation id from a New Relic json extract

# ruff: noqa: ANN401, D103, T201

"""Temporary script: group unique kelvin_simulation_ids by team_id from a JSON log export."""

import json
import sys
from collections import defaultdict
from collections.abc import Iterator
from pathlib import Path
from typing import Any

TEAM_KEY = "request_body.config.team_id"
SIMULATION_KEY = "kelvin_identifier"


def records(node: Any) -> Iterator[dict[str, Any]]:
    """Yield every dict in the structure that carries either key of interest."""
    if isinst

Django language cookies in DEV environment

# Disable Django language cookie in development environment (localhost / 127.0.0.1)
LANGUAGE_COOKIE_ENABLED = True / False

# Alternatively, create a different cookie to each project
if DEBUG:
    LANGUAGE_COOKIE_NAME = "ktivaivrit_language"
    

[Tips] ローカル作業完了後リモートでSupabaseとVercelを動作させるのに必要な手順

[Tips] ローカル作業完了後リモートでSupabaseとVercelを動作させるのに必要な手順
## 検証環境

- Arch Linux Omarchy: 3.8.2
- next: 16.2.12
- Supabase CLI: 2.111.0
- pnpm: 11.24.0

## 対象プロジェクト詳細

- [dont-buy](https://github.com/RyoK73/dont-buy.git)
- 認証機能あり:
  - メール確認あり

## 1. remoteにDBをpushする

1. remoteへDBをリンクする:

```bash
pnpm exec supabase link --project-ref "your-project-ID"
```

2. pushする

```bash
pnpm exec supabase db push
```

## 2. Vercelの環境変数設定

Settings > Enviroments

> `NEXT_PUBLIC`環境変数は公開可能な変数限定です

- `NEXT_PUBLIC_SUPABASE_URL`:
  - 取得方法: [Supabase](https://supabase.com/

[Tips] GitHubの三角アイコン"GitHub Corner"について

[Tips] GitHubの三角アイコン"GitHub Corner"について
> [GitHub Corners](https://tholman.com/github-corners/)

ページ右上に配置するGitHubへのリンクアイコン

skills

---
name: knowledge-ops
description: Knowledge base management, ingestion, sync, and retrieval across multiple storage layers (local files, MCP memory, vector stores, Git repos). Use when the user wants to save, organize, sync, deduplicate, or search across their knowledge systems.
metadata:
  origin: ECC
---

# Knowledge Operations

Manage a multi-layered knowledge system for ingesting, organizing, syncing, and retrieving knowledge across multiple stores.

Prefer the live workspace model:
- cod