# 用切片避免数组或字符越界
```
# s长度大于0则返回第一个字符,否则返回空字符串""
s = ""
first_ch = s[:1]
# s长度大于0则返回倒数第一个字符,否则返回空字符串""
end_ch = s[-1:]
## 数组同理
```
# 用`>>>`表示此行是代码
```
"""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'
# 表示成功
- ✅
- ✔️
- 🍦
- 🍧
- 🍺
- 🎉
# 表示错误
- ❗
# 提示、小贴士
- 💡
- 🔔
# 表示警告
- ⚠️
# 运行、启动
- 🛩️
- 🚀
- ✈️
#添加`-u`参数
```
python -u main.py
```
/**
* @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`报错:不支持该请求
# 解决:
- `控制面板` -> `程序和功能` -> `启用或关闭Windows功能` 勾选`虚拟机平台`和`适用于Linux的Windows子系统`
## Github Actions报错:remote: Permission to nomeqc/naiveproxy-server-build.git denied to github-actions[bot].
- **解决:**
在仓库首页:
`Settings` -> `Actions` -> `General` -> `Workflow permissions` ->
`Read and write permissions`
#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/
https://linuxconfig.org/how-to-check-disk-usage-by-folder-on-linux
/**
* @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
/**
* Выполнять колбэк только по прошествии указанного времени (с момента последнего вызова)
*
* @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);
<?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
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]",
<?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