linux 环境变量文件区别 & 加载顺序

> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [blog.csdn.net](https://blog.csdn.net/yifen4234/article/details/80691434)
> 
> 作者:Solomon1588  
> 原文链接: [https://blog.csdn.net/Solomon1558/article/details/51763751](https://blog.csdn.net/Solomon1558/article/details/51763751)
> 
> Shell 变量有局部变量、环境变量之分。局部变量就是指在某个 Shell 中生效的变量,只在此次登录中有效。环境变量通常又称 “全局变量”,虽然在 Shell 中变量默认就是全局的,但是为了让子 Shall 继承当前 Shell 的变量,需要使用 export 内建命令将其导出为环境变量。

## 一、Linux 的变量种类

按变量的生存周期划分:

*   永久的:需要修改配置文件,变量永久生效

Linux设置代理

> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [cloud.tencent.com](https://cloud.tencent.com/developer/article/2129796)


### 0x00 前言简述

Q: 操作系统的全局代理?

> 答:我们常常听说网络代理例如 Socket、Http 代理,全局代理即系统所有的流量都是通过该代理通道进行通信, 然而这个还不能说是全称走代理,只能说是 90% 的应用都可以使用这个设置来实现代理访问,但这个只是针对于个别软件由于他们更不都不走 http 协议,所有代理的方式不是绝对的,只有网关流量代理是完全代理的;

Q: 网上关于 Linux 中 http_proxy 的设置说明错误

> 答: Linux 操作系统全局代理配置主要在于环境变量的设置 http_proxy 该变量是支持 http 以及 socket 的; 比如 curl、git 软件默认使用 http_proxy 这个环境变量来设置代理[服务器](https://clou

CodeMirror editor for CREATE Mode


HEADER AREA:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/codemirror.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.5/theme/monokai.min.css" />



CONTENT AREA:
<!--  POST CONTENT  -->
<div wire:ignore>
    <div id="editor" style="height: 500px; width: 100%;"></div>
</div>
<!-- Hidden textarea to bind with Livewire -->
<textarea id="content" name="content" style="display:none;" wire:model="post_content"></

Map an ACF userID field to the post's Author field

function my_acf_save_post( $post_id ) {
    // get new value
    $user_id = get_field('lead_designer');
  	if($user_id){
  		wp_update_post( array( 'ID'=>$post_id, 'post_author'=>$user_id) ); 
  	}
}
add_action('acf/save_post', 'my_acf_save_post', 20);

2415. Reverse Odd Levels of Binary Tree

Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose the node values at level 3 are [2,1,3,4,7,11,29,18], then it should become [18,29,11,7,4,3,1,2]. Return the root of the reversed tree. A binary tree is perfect if all parent nodes have two children and all leaves are on the same level. The level of a node is the number of edges along the path between it and the root node.
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {TreeNode}
 */
var reverseOddLevels = function(root) {
    if (!root) return null;

    // Helper function to perform a BFS traversal and reverse node value at odd levels
    const bfs = (root) => {
        const q

2415. Reverse Odd Levels of Binary Tree

Given the root of a perfect binary tree, reverse the node values at each odd level of the tree. For example, suppose the node values at level 3 are [2,1,3,4,7,11,29,18], then it should become [18,29,11,7,4,3,1,2]. Return the root of the reversed tree. A binary tree is perfect if all parent nodes have two children and all leaves are on the same level. The level of a node is the number of edges along the path between it and the root node.
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {TreeNode}
 */
var reverseOddLevels = function(root) {
    if (!root) return null;

    // Helper function to perform a BFS traversal and reverse node value at odd levels
    const bfs = (root) => {
        const q

WSL配置

# WSL 配置

- ## wsl 如何设置 Linux 子系统默认用户为 root
  解决:
1. `WIN` + `R`,输入`cmd`打开命令行窗口
2. 输入命令: `cd %HOMEPATH%\AppData\Local\Microsoft\WindowsApps`,查看安装的子系统对应的应用名,比如:`ubuntu2404.exe`
3. 输入命令:`.\ubuntu2404.exe config --default-user root`
4. 再次打开子系统会发现已经默认登录用户为root了

- ## wsl 如何设置 Linux 子系统默认用户为 root
解决:
1. 输入命令:`wsl -l --all`查看所有版本
2. 命令格式:`wsl --setdefault wsl名称`,例如:`wsl --setdefault Ubuntu-24.04`将Ubuntu-24.04设置为默认子系统

visuallyHidden

視覚的に見えないが存在するようにする。 スクリーンリーダーで読み上げられるようにするためのCSS。 コードの引用元:[テキストを1文字ずつ抜き出して、アニメーションさせる](https://zenn.dev/spicato_blog/articles/f4ccc462fd637c#%E3%81%BE%E3%81%A8%E3%82%81)
.visuallyHidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

Change files

const fs = require('fs')
const data = fs.readFileSync('./networks.json').toString();
const sourceData = JSON.parse(data);
const networks = fs.readFileSync('./networks-list.json').toString();
const sourceNetworks = JSON.parse(networks);
const networksMapping = Object.fromEntries(sourceNetworks.map(({ wallet, network }) => [wallet, network]))

const normalized = sourceData.map((item) => ({
  ...item,
  asset_identifier: item.asset_identifier || item.symbol,
  network: item.network || net

Counter Animation

![demo](https://p61.f2.n0.cdn.zight.com/items/8LuWwJ5z/c577e312-6dd5-4158-8cbe-2dcb946fd272.gif?source=viewer&v=32de331fea777691599a4c60f403239e) Counter Animation met JS voor RAB-Groep voegt een default value toe aan de inhoud in het grid op basis van de tekstinhoud +een animatie (Thomas)
observer.observe(document.body, {
    attributes: true,
    attributeFilter: ['class'],
  });
});

document.addEventListener('DOMContentLoaded', () => {
  const counters = document.querySelectorAll('.counter .el-title');

  const startCounter = (counter) => {
    // Set the data-target attribute based on the current content
    const targetValue = counter.innerText.trim().replace(/[,\.]/g, '');
    counter.setAttribute('data-target', targetValue);

    // Set the initial value to 0

Pet-project

PJxrGPMK5ZTF

Nuxt3 DOMをrefに格納する2つの方法

<template>
  <div ref="div1">useTemplateRefの場合</div>
  <div ref="div2">refの場合</div>
</template>

<script setup>
const div1 = useTemplateRef<HTMLDivElement>('div1')
const div2 = ref<HTMLDivElement | null>(null)
</script>

Button helper

```tsx
import Button, { ButtonProps } from '@mui/material/Button';
import NextLink from 'next/link';
import { LoadingButton } from '@mui/lab'

```
```
LinkComponent={NextLink}
```

addAriaLabelledbyUUID

セクショニング要素とその中の見出し要素を紐づけるためのユーチャリティー関数 - セクショニング要素に属性`aria-labelledby`を付与する。 - 見出し要素に属性`id`を付与する。 - 属性値はどちらも生成したuuidを付与する
<!-- 使用例 -->
<section class="js-labelledby-uuid">
  <h2 class="js-labelledby-uuid__heading">見出しです</h2>
  <p>テキストです</p>
</section>

Bouncing arrow on buttons

const ctaSettings = {
  classes: {
    animate: 'animate',
    arrow: '.icon--arrow-cta'
  },
  animation: {
    duration: 600,
    interval: 5000
  }
}

let ctaLastTime = 0;

// Function to trigger the animation
const ctaAnimationTrigger = () => {
  const ctaArrows = document.querySelectorAll(ctaSettings.classes.arrow);

  ctaArrows.forEach(arrow => arrow.classList.add(ctaSettings.classes.animate));

  requestAnimationFrame(() => {
    setTimeout(() => {
      ctaArrows.forEach(arrow => arrow.c

769. Max Chunks To Make Sorted

You are given an integer array arr of length n that represents a permutation of the integers in the range [0, n - 1]. We split arr into some number of chunks (i.e., partitions), and individually sort each chunk. After concatenating them, the result should equal the sorted array. Return the largest number of chunks we can make to sort the array.
/**
 * @param {number[]} arr
 * @return {number}
 */
var maxChunksToSorted = function(arr) {
    // Variable to keep track of the number of chunks
    let maxChunks = 0;

    // Variable to keep track of the maximum value in the current chuck
    let currentMax = 0;

    // Loop through each element in the array
    for (let i = 0; i < arr.length; i++) {
        // Update the current maximum value in the chuck
        currentMax = Math.max(currentMax, arr[i]);

        // If the current maximum