- https://www.youtube.com/watch?v=WdQBNwomoW8
- https://www.youtube.com/watch?v=sRcNZjG_fyc
- https://www.youtube.com/watch?v=PA-YXMWSLPA
- 小炸弹联盟
- 北方海域
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| REPO="${1:-}" | |
| BRANCH="${2:-}" | |
| if [[ -z "$REPO" ]]; then | |
| echo "Usage: $0 <owner/repo> [branch]" | |
| exit 1 | |
| fi |
| #!/bin/bash | |
| # --- Parameter Setup --- | |
| # Priority: 1. Command Line Args, 2. Env Vars, 3. Default (for Project Slug) | |
| TOKEN="${1:-$CIRCLECI_TOKEN}" | |
| SEARCH_STRING="${2:-$TEST_NAME}" | |
| PROJECT_SLUG="${3:-$PROJECT_SLUG}" # Format: github/org/repo | |
| # --- Validation --- | |
| if [ -z "$TOKEN" ]; then |
On Kubernetes, the biggest wins usually come from: right-sizing CPU/memory to avoid throttling, matching app concurrency to DB/Redis limits, and separately tuning Puma (web) vs Sidekiq (jobs) so they don’t fight for the same resources.
Below is a practical tuning playbook you can apply immediately.
If your pods have a low CPU limit, the Linux CFS scheduler will throttle Ruby, and p95/p99 latency goes bad.
| # PR review helper with multi-provider support. | |
| # Highlights: | |
| # - Run one or MANY providers in a single command: -P gemini -P copilot -P openai | |
| # - Provider adapters for: gemini, qwen, codex, copilot (gh extension), openai (stdin), custom (stdin) | |
| # - Carries forward: include/exclude filters, chunking, merged Markdown, PR comments, quiet mode | |
| # | |
| # Requirements (install what you plan to use): | |
| # - gh (GitHub CLI) + authenticated | |
| # - Providers: | |
| # * gemini: $GEMINI_BIN (default: gemini) expects: gemini -p "<prompt @file>" |
# file: config/initializers/connection_validation_test.rb
# This block will be executed only after Active Record has finished loading.
ActiveSupport.on_load(:active_record) do
# Within this block, it's now safe to modify Active Record components.
module ActiveRecord
module ConnectionAdapters
# It's good practice to check if the class is defined to avoid errors
# in environments where it might not be (e.g., if you switched to MySQL).
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)You’ve just deployed a new version of your application to Google Kubernetes Engine (GKE). The CI/CD pipeline glows green, kubectl get pods shows all pods in a Running state, and your deployment is, by all accounts, successful. You navigate to your application's URL, hit refresh, and are greeted by the dreaded 502 Bad Gateway error.
After a few frantic refreshes, the error vanishes and your application loads perfectly. What just happened? You have readiness probes configured. They should have prevented traffic from reaching the pods before they were ready. Yet, somehow, traffic arrived too early.
This is the story of a common and confusing problem in GKE, born from a simple fact: there aren't one, but two separate health check systems at play. Understanding the division between them is the key to solving the mystery of the premature 502.
Multi-step forms, or "wizards," are a common pattern for guiding users through complex data entry processes like registrations, profile setups, or product configurations. A key challenge in designing these is managing the data collected at each step before the user finally hits that "Submit" button. Where does this transient information live? How do we ensure a smooth user experience without cluttering our database with incomplete records?
One principle should guide us: Don't pollute your primary database with inconsistent, temporary data if you can avoid it. The overhead of storing and then cleaning up these partial records is often more trouble than it's worth. Thankfully, Ruby on Rails offers elegant ways to handle this "in-flight" data, leveraging its powerful object model and session management capabilities.
Let's explore the common strategies and figure out the best path.