# Valkey Tips and Tricks
## Access data in a docker container
1. Access the cli utility: `valkey-cli`$goal 請你負責完成這個任務。
【任務目標】
請完成:{你真正想完成的最終任務}
【完成標準】
只有在以下條件全部成立時,才算真正完成:
1. {可驗證結果 1}
2. {可驗證結果 2}
3. {可驗證結果 3}
【硬性限制】
執行期間必須遵守:
1. 不得 {禁止事項 1}
2. 必須 {限制事項 2}
3. 只可使用 {允許範圍}
4. 若涉及高風險操作,先採用保守方案並保留可回退路徑
【執行方式】
你要自主規劃所需步驟,逐步執行,不要把問題丟回給我,除非你真的被阻塞。
每完成一個重要階段,都要自行檢查目前結果是否更接近完成標準。
如果發現錯誤、衝突或效果不佳,先自己修正,再繼續推進。
優先選擇改動最小、風險最低、最容易驗證的路徑。
不要為了看起來完成而跳過驗證。
【驗證要求】
你每次宣稱完成前,必須明確驗證:
1. {驗證方法 1}
2. {驗證方法 2}
3. {驗證方法 3}
【失敗處理】
如果某條路徑失敗,先嘗試替代方案。
如果仍無法完成,請清楚回報:
1. 卡在哪裡
2. 你已嘗試過什# PHP.ini
## Disable functions in php.ini
`disable_functions = exec,system,passthru,shell_exec,proc_open,proc_close,popen,escapeshellcmd,escapeshellarg,show_source,readfile,parse_ini_file,ini_alter,dl`
## Other config in php.ini (production mode)
- don't show a version of PHP \
`expose_php = Off`
- lock access for a project's folders<sup>*</sup> \
`open_basedir = /var/www/myapp:/usr/share/php:/tmp`
- other directives
```ini
log_errors = On
error_log = /var/log/php-errors.log
/**
* @param {number[]} nums
* @return {number}
*/
var sumOfSquares = function(nums) {
const n = nums.length;
let sum = 0;
// Check every 1-indexed position
for (let i = 1; i <= n; i++) {
// A position is special if it divides n
if (n % i === 0) {
// Convert from 1-indexed position to 0-indexed array index
const value = nums[i - 1];
// Add the square of the special element
sum += value * value;
}
}
/**
* @param {number[]} nums1
* @param {number[]} nums2
* @param {number} k1
* @param {number} k2
* @return {number}
*/
var minSumSquareDiff = function(nums1, nums2, k1, k2) {
const k = k1 + k2;
const diff = [];
let totalDiff = 0;
// Build the array of absolute differences.
for (let i = 0; i < nums1.length; i++) {
const d = Math.abs(nums1[i] - nums2[i]);
diff.push(d);
totalDiff += d;
}
// If we have enough operations to remove every di# Welcome to Cacher
We're delighted you've chosen Cacher to be your snippet organizer! Whether you're a solo developer or a member of your team, Cacher is here to help you organize and use snippets more efficiently.
Our users create snippets to:
- Remember project-specific algorithms
- Create cheatsheets for useful libraries
- Share knowledge with colleagues
Take a few minutes to look over our **Getting Started** snippets. To view more detailed information on features, you can visit [Cacher /**
* @param {string} s
* @return {number}
*/
var minInsertions = function(s) {
let insertions = 0; // number of insertions we've made
let need = 0; // number of ')' still needed
for (const ch of s) {
if (ch === '(') {
// Every '(' needs two ')'
need += 2;
// If need is odd, we have a lone ')'
// that should be paired into '))'
if (need % 2 === 1) {
insertions++; // insert one ')'
-- 1. Zápis pomocí EXISTS
SELECT o.*
FROM `order` o
WHERE EXISTS (
SELECT 1
FROM `user` u
WHERE u.id = o.user_id
AND u.country_code = o.country_code -- Druhá podmínka
AND u.is_active = 1 -- Třetí podmínka
);
-- 2. Zápis pomocí IN
SELECT o.*
FROM `order` o
WHERE (o.user_id, o.country_code) IN (
SELECT u.id, u.country_code
FROM `user` u
WHERE u.is_active = 1
);## # Ducat Protocol
[Ducat Protocol](https://www.ducatprotocol.com/) is a bitcoin-native credit and stablecoin protocol built on Bitcoin L1. Users lock BTC in UTXO vaults via tapscript and borrow a dollar-pegged stablecoin without lenders or custodians.
Website: [https://www.ducatprotocol.com/](https://www.ducatprotocol.com/)
/**
* @param {string} s
* @return {string}
*/
var removeOuterParentheses = function(s) {
let result = [];
let depth = 0; // Tracks the current nesting level of parentheses
for (let i = 0; i < s.length; i++) {
let char = s[i];
if (char === '(') {
// If depth > 0, this '(' is inside the primitive string (not the outermost)
if (depth > 0) {
result.push(char);
}
depth++; // Increase depth aftimport { Component } from '@theme/component';
import { onAnimationEnd } from '@theme/utilities';
import { ThemeEvents, CartUpdateEvent } from '@theme/events';
/**
* A custom element that displays a cart icon.
*
* @typedef {object} Refs
* @property {HTMLElement} cartBubble - The cart bubble element.
* @property {HTMLElement} cartBubbleText - The cart bubble text element.
* @property {HTMLElement} cartBubbleCount - The cart bubble count element.
*
* @extends {Component<Refs>}
*/
class Ca# pre-commit — tutoriel synthétique et progressif
## Préambule
**Public visé.** Data engineer Python (dbt, Snowflake, DuckDB, AWS) sous Linux, shell zsh, qui connaît Git au quotidien (`add`, `commit`, `push`) et veut que les vérifications répétitives — espaces en fin de ligne, YAML invalide, lint Python, secrets, fichiers trop gros — se fassent toutes seules avant chaque commit, sur son poste comme en CI. Il s'agit de **pre-commit, le framework** (pre-commit.com), à ne pas confondre avec le ho# grep — tutoriel synthétique et progressif
## Préambule
**Public visé.** Data engineer Python (dbt, Snowflake, DuckDB, AWS) sous Linux, shell zsh, qui tape `grep -ri motif .` par réflexe et veut chercher vite et juste dans des journaux, des CSV et un dépôt de code, puis utiliser grep dans des scripts. Les expressions régulières de base sont supposées connues (tutoriels sed et awk de la série) : ce volet systématise ce qui change **d'un dialecte à l'autre** et **d'une implémentation à l'autre* <p>
[company_profile:node:field_company_address:address_line1]<br>
[company_profile:node:field_company_address:locality] [company_profile:node:field_company_address:administrative_area] [company_profile:node:field_company_address:postal_code]
</p>/**
* @param {string} s
* @return {string[]}
*/
var removeInvalidParentheses = function(s) {
const result = [];
const visited = new Set([s]);
const queue = [s];
// Checks whether a string has valid parentheses
function isValid(str) {
let balance = 0;
for (const ch of str) {
if (ch === '(') {
balance++;
} else if (ch === ')') {
// More closing than opening parentheses
if (balance === 0_