st.session_state

"""
Complete st.session_state Tutorial App
This app demonstrates ALL use cases of st.session_state with interactive examples.
"""

import streamlit as st
import pandas as pd
from datetime import datetime, timedelta
import random

# ============================================================================
# PAGE CONFIGURATION
# ============================================================================
st.set_page_config(
    page_title="Session State Tutorial",
    page_icon="

1161. Maximum Level Sum of a Binary Tree

Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level x such that the sum of all the values of nodes at level x is maximal.
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var maxLevelSum = function(root) {
    // Edge case: if the tree is empty (not typical for this problem)
    if (!root) return 0;

    // Queue for BFS - start with the root
    const queue = [root]

 

html template

# Option 1: Modern Vibrant Gradient (Sunset Orange to Pink)
st.markdown("""
<div style='
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 50%, #FFA07A 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
    text-align: center;
    margin-bottom: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
'>
    <h2 style='
        color: white;
        font-weight: bold;
        margin: 0;
        font-size: 28px;
        l

Animated Rotating Headlines

A better way to animate your headlines that goes beyond the standard way that we do it. https://www.youtube.com/watch?v=SEoEtsA3epY https://learn.websquadron.co.uk/codes/#text-rotate
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper/swiper-bundle.min.css" />

<!-- Carousel -->
<div class="swiper looping-words">
  <div class="swiper-wrapper">
    <div class="swiper-slide">Get noticed fast</div>
    <div class="swiper-slide">Win more leads</div>
    <div class="swiper-slide">Sell with ease</div>
    <div class="swiper-slide">Build real trust</div>
    <div class="swiper-slide">Grow every day</div>
  </div>
</div>

<!-- Swiper Scripts -->
<script sr

Full-Stack AI & Automation Suite

This template deploys a comprehensive ecosystem for building and hosting private AI agents and workflows: - **Workflow Engine:** n8n backed by a PostgreSQL 16 database. - **Local LLM Host:** Ollama configured with NVIDIA GPU passthrough for high-performance local inference. - **Web Interface:** Open WebUI for interacting with Ollama models and managing chats. - **Security:** Cloudflare Tunnel (cloudflared) to expose services safely without opening firewall ports. - **Maintenance:** Watchtower to keep all images updated automatically. _Prerequisites: Requires an .env file for credentials (Postgres, n8n encryption, Cloudflare token) and NVIDIA Container Toolkit for GPU support._
services:
  postgres:
    image: postgres:16-alpine
    container_name: n8n-postgress
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - ./postgres_data:/var/lib/postgresql/data

  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    environment:
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
      - 

how to create and initialize a string array

package main

import "fmt"

func main() {
	fruits := [4]string{"Apple", "Banana", "Orange", "Grapes"}
	fmt.Println("Fruits array:", fruits)
}

how to print text in the terminal in goland?

// import fmt #format package
// fmt.Println

package main

import "fmt"

func main() {
	var numbers [5]int
	fmt.Println("Default values in an integer array:", numbers)
}

Css Color: from var

/*
https://jsbin.com/setohiqiwe/edit?html,css,output
*/

:root {
	--color: red;
}

.a, .b, .c {
	margin: 1rem;
	padding: 0.55rem;
}


.a {
	background: hsl(from var(--color) h s 90%);
}

.b {
	background: hsl(from var(--color) h s calc(l + 40));
}

.c {
	background: hsl(from var(--color) h s l / 0.2);
}




/*

Converted to HSL, red is hsl(0 100% 50%), thus:

Setting l to 90%,
Is just hsl(0 100% 90%).

Adding 40 to l,
Add the l components together:
hsl(0 100% (50% + 40%)) → hsl(0 100% 90%)

Chan

Get-IniContent

function Get-IniContent ($filePath) {
    $ini = @{}
    switch -regex -file $FilePath {
        "^\[(.+)\]" {
            # Section
            $section = $matches[1]
            $ini[$section] = @{}
            $CommentCount = 0
        }
        "^(;.*)$" {
            # Comment
            $CommentCount++
            $name = "Comment$($CommentCount)"
            $value = $matches[1]
            $ini[$section][$name] = $value
        }
        "(.+?)\s*=(.*)" {
            # 

aa

aaaa

My Ubuntu desktop setup

My Ubuntu desktop setup

all:

loading screen scroll to hide

const loadingScreen = document.querySelector('.loading-screen');

if (loadingScreen) {
  const CONFIG = {
    fadeThreshold: 150,
    bufferZone: 50,
    reactivateAt: 5,
    wheelMultiplier: 0.8,
    touchMultiplier: 1.5,
    extraVirtualCap: 100
  };

  const UNLOCK_THRESHOLD = CONFIG.fadeThreshold + CONFIG.bufferZone;
  const MAX_VIRTUAL = UNLOCK_THRESHOLD + CONFIG.extraVirtualCap;

  const state = {
    ticking: false,
    virtualY: 0,
    locked: false,
    savedScrollY: 0,
    hasLeftTop: 

how to know an absolute path of a file?

realpath file.txt

# realpath is part of GNU coreutils

# Installed by default on most Linux distributions

1390. Four Divisors

Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors. If there is no such integer in the array, return 0.
/**
 * @param {number[]} nums
 * @return {number}
 */
var sumFourDivisors = function(nums) {
    // Helper: return the sum of divisors of n if it has exactly 4 divisors.
    // Otherwise return 0.
    function sumIfFourDivisors(n) {
        let count = 0; // how many divisors we've found
        let sum = 0;   // sum of those divisors

        // Check all possible divisors from 1 up to sqrt(n)
        for (let d = 1; d * d <= n; d++) {
            if (n % d === 0) {
                let other = 

ある要素に適用されているスタイルをUAデフォルトまで全て取り消す

<p class="text">テキスト</p>

メール認証技術(SPF・DKIM・DMARC)メモ

# メール認証技術(SPF・DKIM・DMARC)学習メモ

---

## 1. SPF(Sender Policy Framework)

### 概要

- 「このドメインからのメールは、これらのIPアドレスから送信される」とDNSで宣言する仕組み
- 受信サーバーが送信元IPをSPFレコードと照合し、正当性を検証する

### なぜ必要か

- SMTPプロトコルは送信元アドレスを検証する仕組みを持たない
- 任意のサーバーから任意の送信元アドレスでメール送信が可能
- SPFにより、ドメイン所有者が「正当な送信元IP」を定義できる

### 設定場所

- ドメインのDNS TXTレコード

### レコード例

```
example.com. IN TXT "v=spf1 ip4:203.0.113.1 include:_spf.google.com -all"
```

| 部分 | 意味 |
|------|------|
| `v=spf1` | SPFバージョン1 |
| `ip4:203.0.113.1` | このIPからの送信を許可 |
| `include: