python 序列类型切片技巧

# 用切片避免数组或字符越界
```
# s长度大于0则返回第一个字符,否则返回空字符串""
s = ""
first_ch = s[:1]

# s长度大于0则返回倒数第一个字符,否则返回空字符串""
end_ch = s[-1:]

## 数组同理
```

python 方法注释写法

# 用`>>>`表示此行是代码
```
"""Return (exitcode, output) of executing cmd in a shell.

    Execute the string 'cmd' in a shell with 'check_output' and
    return a 2-tuple (status, output). The locale encoding is used
    to decode the output and process newlines.

    A trailing newline is stripped from the output.
    The exit status for the command can be interpreted
    according to the rules for the function 'wait'. Example:

    >>> import subprocess
    >>> subprocess.getstatusoutput('ls /bin/ls'

常用emoji

# 表示成功
- ✅
- ✔️
- 🍦
- 🍧
- 🍺
- 🎉

# 表示错误
- ❗

# 提示、小贴士
- 💡
- 🔔
# 表示警告
- ⚠️

# 运行、启动
- 🛩️
- 🚀
- ✈️

python 3 print禁用缓存

#添加`-u`参数
```
python -u main.py
```

1760. Minimum Limit of Balls in a Bag

You are given an integer array nums where the ith bag contains nums[i] balls. You are also given an integer maxOperations. You can perform the following operation at most maxOperations times: Take any bag of balls and divide it into two new bags with a positive number of balls. For example, a bag of 5 balls can become two new bags of 1 and 4 balls, or two new bags of 2 and 3 balls. Your penalty is the maximum number of balls in a bag. You want to minimize your penalty after the operations. Return the minimum possible penalty after performing the operations.
/**
 * @param {number[]} nums
 * @param {number} maxOperations
 * @return {number}
 */
var minimumSize = function(nums, maxOperations) {
    // Helper function to determine if a given max_bag_size can be achieved with the allowed operations
    function canAchieve(max_bag_size) {
        let operations = 0;
        for (let balls of nums) {
            if (balls > max_bag_size) {
                // Calculate the number of splits needed for the current bag
                operations += Math.floor

win10 输入wsl报错:不支持该请求

# win10 输入`wsl`报错:不支持该请求

# 解决:
- `控制面板` -> `程序和功能` -> `启用或关闭Windows功能` 勾选`虚拟机平台`和`适用于Linux的Windows子系统`

Github Actions报错:remote: Permission to nomeqc/naiveproxy-server-build.git denied to github-actions[bot].

## Github Actions报错:remote: Permission to nomeqc/naiveproxy-server-build.git denied to github-actions[bot].
- **解决:**
在仓库首页:
 `Settings` -> `Actions` -> `General` -> `Workflow permissions` -> 
`Read and write permissions`

NAV2016 to Cloud

#modules
Import-module "${env:ProgramFiles}\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1”


#global vars
$username = 'user1'
$PartnerLicense = 'C:\Temp\BC14DEV.flf'
$ServerInstance = 'BC140_CIF'
$ExtName = 'CIF - BC14 Temp Extension'

#Kick out users
#Stop Job Queues
#Disable CRM
#Create a Backup
#Restose Database
#Map user to Database
#Setup Serice Tier
#Add User to Database SQL 
#if the finsql gives driver error on temp server, install 
https://www.microsoft.com/en-US/

Tips Disk Usage Ubuntu

https://linuxconfig.org/how-to-check-disk-usage-by-folder-on-linux

2554. Maximum Number of Integers to Choose From a Range I

You are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules: The chosen integers have to be in the range [1, n]. Each integer can be chosen at most once. The chosen integers should not be in the array banned. The sum of the chosen integers should not exceed maxSum. Return the maximum number of integers you can choose following the mentioned rules.
/**
 * @param {number[]} banned
 * @param {number} n
 * @param {number} maxSum
 * @return {number}
 */
var maxCount = function(banned, n, maxSum) {
    // Convert banned array to a set for O(1) lookups
    const bannedSet = new Set(banned);
    let currentSum = 0; // Initialize the sum of chosen integers
    let count = 0; // Initialize the count of chosen integers

    // Iterate through integers from 1 to n
    for (let i = 1; i <= n; i++) {
        // Skip if the integer is in the banned set

debounce - Выполнять колбэк только по прошествии указанного времени (с момента последнего вызова)

/**
 * Выполнять колбэк только по прошествии указанного времени (с момента последнего вызова)
 *
 * @param func
 * @param delay
 *
 * @returns
 */
function debounce(func, delay) {
	let timeout;
	return function (...args) {
		clearTimeout(timeout);
		timeout = setTimeout(() => {
			func.apply(this, args);
		}, delay);
	};
}

const handleInput = debounce(() => {
	console.log('Функция вызвана после задержки');
}, 300);

document.querySelector('input').addEventListener('input', handleInput);

Closure modifier

<?php
//  TransportListResolver
class {
    public function getList(Order\Order $order, ?\Closure $transportListResolverModifier = null): array {
  .
  .
  .
  
    if ($transportListResolverModifier) {
    	$transportListResolverModifier($transportListResolver);
    }
  .
  .
  .
  
  }
}


// usage in another class
// we can modify object via closure
$transportList = $this->transportListResolver->getList($order, function (TransportEshopOrderSelectionResolver $transportListResolver) {
			$trans

Language Validation Service

public static class DocumentLanguageValidator
    {
        // Language validation regexes
        private static readonly string[] RestrictedLanguagePatterns = new string[]
        {
            // Arabic (Includes Persian and Urdu)
            @"[\u0600-\u06FF\u0750-\u077F]", // Arabic Script and Supplement

            // Chinese (Unified Han Characters)
            @"[\u4E00-\u9FFF]", // Mandarin and Cantonese

            // Tagalog (Philippines)
            @"[\u1700-\u171F]", 

Alfred Workflow: Lookup IP Address from selection

<?php
//
// Do NOT USE OPENING <?php TAG IN ALFRED APP
//

/**
 * Open 1 or more (comma or new line separated) IP Addresses from selection.
 *
 * @link https://github.com/cliffordp/alfred-app-workflows Download this Alfred App Workflow's code (and more).
 * @link https://gist.github.com/cliffordp/ This Alfred App Workflow's code snippet.
 */

// CHANGE THIS if you want it to work for a different site.
$url_base = 'https://dnschecker.org/ip-location.php?ip=';

// turn New Lines into commas
$query