Skip to content

Instantly share code, notes, and snippets.

View lemonied's full-sized avatar

ChenJiYuan lemonied

  • Digital Engine
  • Zhengzhou,Henan,China
View GitHub Profile

存储

# 查看当前文件夹占用空间(linux)
du -h --max-depth=0
# macos
du -d 0

# 查看磁盘占用情况
df -h
@lemonied
lemonied / swap.md
Last active February 21, 2024 08:37

swap内存交换空间

# 查看已经配置过的内存交换空间
swapon -s

# 预占磁盘空间(1024 * 1024 * 16 = 16777216)
dd if=/dev/zero of=/data/swap bs=1024 count=16777216

# 格式化分区

备份(用当前时间命名)

#/bin/bash

datestr=`date +%Y-%m-%d_%H%M%S`
datepath="/home/steam/backup/"${datestr}"/"

echo $datepath
@lemonied
lemonied / frp.md
Last active August 27, 2025 06:16

systemd

# 使用 yum 安装 systemd(CentOS/RHEL)
yum install systemd

# 使用 apt 安装 systemd(Debian/Ubuntu)
apt install systemd
@lemonied
lemonied / ssh.md
Last active February 19, 2024 09:48

ssh

# ssh反向隧道代理
# ssh -R [bind_address:]port:host:hostport
ssh -NR 7890:127.0.0.1:7890 root@60.205.136.23

# 设置代理服务(当前shell生效)
export http_proxy=http://127.0.0.1:7890 https_proxy=http://127.0.0.1:7890
@lemonied
lemonied / git.md
Last active July 28, 2025 08:26
Git笔记

必备设置

修改git config core.quotepath,否则包含中文名称的路径将会被转移成\xx\xx
git config --global core.quotepath false
# ed25519秘钥生成
ssh-keygen -t ed25519
# 查看公钥
@lemonied
lemonied / react 18.md
Last active November 28, 2023 11:47
react 18严格模式 useEffect为什么会执行两次
@lemonied
lemonied / key-paths.ts
Last active August 5, 2022 11:07
Typescript
type DotPrefix<T extends string> = T extends '' ? '' : `.${T}`;
type KeyPaths<T> = (T extends object ? { [K in Exclude<keyof T, symbol>]: `${K}${DotPrefix<KeyPaths<T[K]>>}` }[Exclude<keyof T, symbol>] : '') extends infer D ? Extract<D, string> : never;