Skip to content

Instantly share code, notes, and snippets.

View dz85's full-sized avatar
😀
Enjoying coding...

David Z. dz85

😀
Enjoying coding...
View GitHub Profile
@dz85
dz85 / auto_mount.bash
Created October 3, 2025 09:22
自动挂载Linux磁盘脚本
#!/bin/bash
# 自动挂载磁盘脚本
# 功能:将指定磁盘挂载到指定目录,并配置开机自动挂载
# 使用方法:./auto_mount.sh <device> <mount_point> [filesystem_type]
set -e # 遇到错误立即退出
# 颜色定义
RED='\033[0;31m'
@dz85
dz85 / install_fail2ban_amzn2.sh
Created January 10, 2023 11:45
install fail2ban on amazon linux 2
# run as root or sudo everything below
# install epel
amazon-linux-extras install epel -y
# install fail2ban
yum -y install fail2ban
# configure fail2ban (just adding enabled=true in the sshd section)
cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
@dz85
dz85 / stars.md
Last active December 2, 2022 06:04

Keybase proof

I hereby claim:

  • I am dz85 on github.
  • I am dz85 (https://keybase.io/dz85) on keybase.
  • I have a public key ASBL_bZ5Laae4D77zin3x8SX1Mq_iVN2fXn-rPkv3AbcoQo

To claim this, I am signing this object:

@dz85
dz85 / esm-package.md
Created July 1, 2022 17:52 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@dz85
dz85 / bootscripts-execution-sequence-for-bash.puml
Last active September 16, 2021 16:38
不同shell下启动脚本加载流程图
@startuml bash启动脚本加载流程图
!theme sketchy-outline
title bash启动脚本加载流程图
footer by David.Z @ 2021.09.17
start
if (login?) then (y)
if (interactive?) then (y)
else ($failure("n"))
@dz85
dz85 / mac_mover.sh
Last active November 29, 2019 17:56
#! /usr/bin/env sh
printf "Usage:\n"
printf " curl -sSL -H 'Cache-Control: no-cache' https://gist.githubusercontent.com/bkbabydp/1d9079f98d4f1e64e888621932e2dbd4/raw | sh\n\n"
[ -n "$1" ] || exit
move_url=https://gist.githubusercontent.com/bkbabydp/588b58efc4dd18ee3f47c2c4a9879661/raw
ssh-copy-id dz@"$1"
@dz85
dz85 / mac_mover.txt
Last active November 29, 2019 16:40
.ssh/aliyun_rsa
project
.ssh
@dz85
dz85 / mac_init.sh
Last active November 28, 2019 15:38
#! /usr/bin/env sh
echo "by David Z. <geek(at)lzw.name>\n\n"
echo "usage: curl -sSL https://gist.githubusercontent.com/bkbabydp/2b9c29634f6180e94a628b7822099926/raw | sh"
echo "The first things:"
echo "1. need curl"
echo "2. set up ~/.ssh/id_rsa"
echo "3. ..."
@dz85
dz85 / cn_source.sh
Last active June 17, 2020 09:25
设置为国内源
#! /usr/bin/env sh
echo "Usage:"
echo " curl -sSL https://gist.githubusercontent.com/bkbabydp/6d8277eead2f21db173d32120fc14827/raw | sh"
git config --global user.name "David Z.(from server)"
git config --global user.email geek@lzw.name
echo "nodejs=>"