本番DB編集時の注意事項と手順

# 本番DB変更手順メモ

## 前提

- Webアプリケーション開発における本番DB変更を対象とする。
- 作業は一人で実施する。担当者決定、承認者決定、監視担当者決定、会議体調整は扱わない。
- 対象はスキーマ変更、データ変更、スキーマ変更とアプリケーション変更が同時に必要な作業。
- SQL、マイグレーション、確認クエリ、ロールバッククエリ、実行ログを作業単位で保存する。
- DBMS固有のコマンド名はこのメモでは固定しない。採用DBの公式マニュアルで該当構文、ロック、トランザクション、バックアップ、リストアを確認する。
- 本番DBで最初に実行する作業を作らない。ステージング、複製環境、ローカル再現環境、本番トランザクション内検証の順で実行前確認を増やす。

---

## 用語

- DDL: テーブル、カラム、インデックス、制約、ビュー、トリガーを含む定義変更SQL。
- DML: INSERT、UPDATE、DELETEを含む行データ変更SQL。
- 反映SQL: 本番DBへ適用するSQLまたはマイグレーション。
- 戻しSQL: 反映SQLの結果を戻すSQL。DDLの

15-chicano-prompts

A complex, vintage Chicano tattoo-style graphic composition featuring a classic 90s luxury lowrider sedan cruising low through a Phoenix barrio summer night, wire spoke wheels shining, whitewall tires, chrome bumpers, and desert dust trailing behind it. Above the car looms a large menacing skull wearing aviator sunglasses and a snapback cap reading “PHX WESTSIDE,” surrounded by palm trees, saguaros, power lines, dice, roses, and heat-wave ribbons. Elaborate gothic typography reads “SUMMERTIME CR

aihub api key

sk-69hm1myE1iPWZ3dZF8782b2073Da4c25B0364a45589c0153

2574. Left and Right Sum Differences

You are given a 0-indexed integer array nums of size n. Define two arrays leftSum and rightSum where: leftSum[i] is the sum of elements to the left of the index i in the array nums. If there is no such element, leftSum[i] = 0. rightSum[i] is the sum of elements to the right of the index i in the array nums. If there is no such element, rightSum[i] = 0. Return an integer array answer of size n where answer[i] = |leftSum[i] - rightSum[i]|.
/**
 * @param {number[]} nums
 * @return {number[]}
 */
var leftRightDifference = function(nums) {
  const n = nums.length;
  const ans = new Array(n);   // final result array

  // Compute the total sum once.
  // This lets us derive the right-side sum on the fly.
  let total = 0;
  for (let x of nums) total += x;

  let left = 0;  // running sum of elements to the left of i

  for (let i = 0; i < n; i++) {
    // Right sum is everything except:
    // - the left portion we've already accumulat

prompt

A complex, vintage Chicano tattoo-style graphic composition featuring a large menacing skull wearing aviator sunglasses and a snapback cap reading 'Nawf Side'. Below the skull is elaborate, ornate gothic typography reading 'TRILLA THAN THA REST' intertwined with decorative flowing ribbons. At the base sits a classic 90s luxury lowrider sedan with wire spoke wheels, flanked by stacks of hundred dollar bills, a smoking double styrofoam cup, a giant faceted diamond, and a smaller skull resting on a

prompt

A complex, vintage Chicano tattoo-style graphic composition featuring a large menacing skull wearing aviator sunglasses and a snapback cap reading 'Nawf Side'. Below the skull is elaborate, ornate gothic typography reading 'TRILLA THAN THA REST' intertwined with decorative flowing ribbons. At the base sits a classic 90s luxury lowrider sedan with wire spoke wheels, flanked by stacks of hundred dollar bills, a smoking double styrofoam cup, a giant faceted diamond, and a smaller skull resting on a

3753. Total Waviness of Numbers in Range II

You are given two integers num1 and num2 representing an inclusive range [num1, num2]. The waviness of a number is defined as the total count of its peaks and valleys: A digit is a peak if it is strictly greater than both of its immediate neighbors. A digit is a valley if it is strictly less than both of its immediate neighbors. The first and last digits of a number cannot be peaks or valleys. Any number with fewer than 3 digits has a waviness of 0. Return the total sum of waviness for all numbers in the range [num1, num2].
/**
 * @param {number} num1
 * @param {number} num2
 * @return {number}
 */
var totalWaviness = function (num1, num2) {
    return solve(num2) - solve(num1 - 1);

    function solve(n) {
        if (n < 0) return 0;

        const s = String(n);
        const len = s.length;
        const memo = new Map();

        // Returns: { waviness, count }
        function dfs(pos, tight, last, secondLast) {
            const key = pos + "," + tight + "," + last + "," + secondLast;
            if (memo.ha

fix blog image

jQuery(document).ready(function () {
  jQuery('.blog-posts picture source, .blog-posts picture img').each(function () {
    var $el = jQuery(this);

    function fixPath(val) {
      if (!val) return val;
      return val.replace(
        /\/files\/styles\/[^/]+\/public\/images\/([^\s?]+?)(?:\?[^\s]*)?(\s+\d+x)?$/g,
        function (match, filename) {
          var clean = filename.replace(/^(.+\.\w+)\.webp$/, '$1');
          return '/files/images/' + clean;
        }
      );
    }

    var s

Remove pyc files and empty folders

# Remove all .pyc files, except the ones in .venv folder
# Preview
find . -type d -name '.venv' -prune -o -type f -name '*.pyc' -print
# Delete
find . -type d -name '.venv' -prune -o -type f -name '*.pyc' -exec rm -f {} +

PWD_REWRITE

Building the V1 Agent‑Powered Agency Platform
Introduction

This document outlines the architecture and implementation plan for Version 1 of the AI‑powered design/development agency platform. The goal is to deliver a reliable, maintainable prototype that demonstrates how specialized agents can work together to perform research, generate strategy documents and code, and handle client outreach. The plan emphasises a simple orchestration model rather than complex distributed coordination so the sys

Model Development Cheatsheet

Linear Regression
  from sklearn.linear_model import
  LinearRegression
  lr = LinearRegression()
  
Train Linear Regression model
  X = df[['attribute1','attribute2']]
  Y = df['target_attribute']
  lr.fit(X,Y)
Output predicitons
  Y_hat = lr.predict(X)
  
Identify the coefficient and intercept
  coeff = lr.coef
  intercept = lr.intercept_
  
Residual Plot
  import seanorn as sns
  sns.residualplot(x=df['attribute1'], y=df['attribute2'])
  
Distribution Plot
  import seaborn as sns
  sns.displo

3751. Total Waviness of Numbers in Range I

You are given two integers num1 and num2 representing an inclusive range [num1, num2]. The waviness of a number is defined as the total count of its peaks and valleys: A digit is a peak if it is strictly greater than both of its immediate neighbors. A digit is a valley if it is strictly less than both of its immediate neighbors. The first and last digits of a number cannot be peaks or valleys. Any number with fewer than 3 digits has a waviness of 0. Return the total sum of waviness for all numbers in the range [num1, num2].
/**
 * @param {number} num1
 * @param {number} num2
 * @return {number}
 */
var totalWaviness = function(num1, num2) {
    // This will accumulate the total waviness across the entire range.
    let total = 0;

    // Iterate through every number in the inclusive range [num1, num2].
    for (let n = num1; n <= num2; n++) {

        // Convert the number to a string so we can easily access its digits.
        const s = String(n);
        const len = s.length;

        // Numbers with fewer than 3

SharePoint - Audit Site Owners

# === CONFIGURATION ===
$AdminSiteUrl = "https://westernssmokehouse-admin.sharepoint.com"
$ClientId     = "715390fe-65ce-48b0-ad72-081abb196164"
$ExportPath   = "C:\Users\Public\Downloads\SiteOwners_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"

# === CONNECT TO SHAREPOINT ADMIN CENTER ===
Connect-PnPOnline -Url $AdminSiteUrl -Interactive -ClientId $ClientId

# === GET ALL SITE COLLECTIONS ===
Write-Host "Retrieving all site collections..." -ForegroundColor Cyan
$Sites = Get-PnPTenantSite

Turbo Frames & Streams

## TURBO FRAMES
- A frame, or designated area, that will respond to a click that **renders** a response
(usually HTML)
- Create the turbo frame:
```rb
# views/model/some_page.html.erb
<%= turbo_frame_tag('some-identifier') do %>
  <%= render partial: '...', locals: { } %>
<% end %>
```
- The above text snippet will respond to a request: for example:
  - If you click on a link that routes to the `show` action, instead of the action
taking you to the show page, turbo takes the `html` returned from

Database Encryption

## Database Encryption Rails 8 App

- Secure database using: `bin/rails db:encryption:init`
- Edit and add the keys from the above command to your credential file: 
  - `EDITOR="code --wait" rails credentials:edit`

### Useage
- In `model.rb`, add `encrypts :attribute` to encrypt the attribute

### Viewing
- If the db gets compromised, this is what the hacker will see:
```
INSERT INTO "entries" 
(... '{"p":"lPJmyUnvP1gW9D2SAdVURF0=",
"h":{"iv":"sndLY4XcPzRFCbRl","at":"A62cIuZQYG8qSwzrokLixA=="}}

3635. Earliest Finish Time for Land and Water Rides II

You are given two categories of theme park attractions: land rides and water rides. Land rides landStartTime[i] – the earliest time the ith land ride can be boarded. landDuration[i] – how long the ith land ride lasts. Water rides waterStartTime[j] – the earliest time the jth water ride can be boarded. waterDuration[j] – how long the jth water ride lasts. A tourist must experience exactly one ride from each category, in either order. A ride may be started at its opening time or any later moment. If a ride is started at time t, it finishes at time t + duration. Immediately after finishing one ride the tourist may board the other (if it is already open) or wait until it opens. Return the earliest possible time at which the tourist can finish both rides.
/**
 * @param {number[]} landStartTime
 * @param {number[]} landDuration
 * @param {number[]} waterStartTime
 * @param {number[]} waterDuration
 * @return {number}
 */
var earliestFinishTime = function(landStart, landDur, waterStart, waterDur) {
    function solve(Astart, Adur, Bstart, Bdur) {
        const n = Astart.length, m = Bstart.length;

        // Build B rides sorted by start time
        let B = [];
        for (let i = 0; i < m; i++) B.push([Bstart[i], Bdur[i]]);
        B.sort((a, b