FLIP Sheeter

Add in a detail wrangle to add additional particles in thin areas of a flip sim (post-sim) to fill in gaps and fix flickering meshes
// Use in detail wrangle

float search_radius = chf("search_radius");
float min_dist = chf("min_dist");
int points_per_pt = chi("points_per_pt");
int max_neighbors = chi("max_neighbors");
int seed = chi("seed");

int original_npts = npoints(0);

for (int pt = 0; pt < original_npts; pt++)
{
    vector P0 = point(0, "P", pt);
    int near[] = nearpoints(0, P0, search_radius, max_neighbors);

    // Need enough particles to define local volume
    if (len(near) < 4)
        continue;

    for (int 

3871. Count Commas in Range II

You are given an integer n. Return the total number of commas used when writing all integers from [1, n] (inclusive) in standard number formatting. In standard formatting: A comma is inserted after every three digits from the right. Numbers with fewer than 4 digits contain no commas.
/**
 * @param {number} n
 * @return {number}
 */
var countCommas = function(n) {
    // Convert n to BigInt so all math stays consistent
    n = BigInt(n);

    // Use BigInt for total since we accumulate BigInt values
    let total = 0n;

    // k represents how many commas numbers in this group have
    // Group 1 → 1 comma (digits 4–6)
    // Group 2 → 2 commas (digits 7–9)
    // Group 3 → 3 commas (digits 10–12)
    // ... up to n ≤ 10^15 → at most 4 commas
    for (let k = 1n; k <= 5n; k++

3870. Count Commas in Range

You are given an integer n. Return the total number of commas used when writing all integers from [1, n] (inclusive) in standard number formatting. In standard formatting: A comma is inserted after every three digits from the right. Numbers with fewer than 4 digits contain no commas.
/**
 * @param {number} n
 * @return {number}
 */
var countCommas = function(n) {
    // Numbers from 1 to 999 never contain commas in standard formatting.
    // Starting at 1000, every number has exactly ONE comma (e.g., "1,000", "4,582").

    // So we simply count how many numbers from 1000 up to n exist.
    // If n < 1000, the result should be 0 - hence Math.max(0, n - 999).

    return Math.max(0, n - 999);
};

940. Distinct Subsequences II

Given a string s, return the number of distinct non-empty subsequences of s. Since the answer may be very large, return it modulo 109 + 7. A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., "ace" is a subsequence of "abcde" while "aec" is not.
/**
 * @param {string} s
 * @return {number}
 */
var distinctSubseqII = function(s) {
    const MOD = 1_000_000_007;
    const last = Array(26).fill(0);

    let dp = 1; // counts empty subsequence initially

    for (const ch of s) {
        const idx = ch.charCodeAt(0) - 97;

        const newDp = (dp * 2 % MOD - last[idx] + MOD) % MOD;

        last[idx] = dp;
        dp = newDp;
    }

    return (dp - 1 + MOD) % MOD; // remove empty subsequence
};

Mermaid

# Mermaid

### Generate PNG images
`npx @mermaid-js/mermaid-cli --scale 2.5 -i mermaid-diagram.md -o diagram.png`

115. Distinct Subsequences

Given two strings s and t, return the number of distinct subsequences of s which equals t. The test cases are generated so that the answer fits on a 32-bit signed integer.
/**
 * @param {string} s
 * @param {string} t
 * @return {number}
 */
var numDistinct = function(s, t) {
    const m = s.length, n = t.length;

    // dp[j] = number of ways to form t[0..j-1] using processed part of s
    const dp = Array(n + 1).fill(0);

    // Empty string t ("") can always be formed once — by deleting everything
    dp[0] = 1;

    // Iterate through characters of s
    for (let i = 1; i <= m; i++) {

        // Traverse backwards so dp[j - 1] refers to previous row's value
 

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>