123 gists results Add gist
netnr/ backup_sqlserver.bat 2022-03-22 15:46
SQLServer 备份脚本 Windows
@echo off

:: 配置参数(开始)===

set ymd=%date:~0,4%%date:~5,2%%date:~8,2%
echo 日期:%ymd%
echo.
set keepday=15
echo 保留最近天数:%keepday%
echo.
查看详情
netnr/ git filter-branch.sh 2022-03-04 14:19
GitHub 泄露密钥,彻底删除历史记录
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch -r 要删除的文件" --prune-empty --tag-name-filter cat -- --all
# 遍历所有 commit,删除文件,重写历史 commit,项目顶层执行

git push origin --all --force # 强行远程推送
查看详情
netnr/ PostgreSQL-Manager.sql 2022-02-08 15:57
PostgreSQL 用户授权
-- 创建用户
CREATE USER dbUser WITH PASSWORD 'Abc123....';

-- 数据库授权用户,此时用户还是没有读写权限,需要授权表
GRANT ALL PRIVILEGES ON DATABASE dbName TO dbUser;

-- 当前数据库下 public schema 的表都授权给 dbUser
GRANT ALL PRIVILEGES ON all tables in schema public TO dbUser;

-- 指定表授权
查看详情
netnr/ tcping 2022-01-18 11:30
Linux TCP ping
apt-get install tcptraceroute -y # 依赖

# 一键安装
wget -O /usr/bin/tcping https://raw.githubusercontent.com/deajan/tcpping/master/tcpping && chmod 755 /usr/bin/tcping
wget -O /usr/bin/tcping http://www.vdberg.org/~richard/tcpping && chmod 755 /usr/bin/tcping # 另一个源


# help
https://github.com/deajan/tcpping
查看详情
netnr/ file-split.sh 2021-11-24 15:23
文件切割、合并
split -l 100000 -d access.log part/access_ --verbose # 按行切割
split -b 100m access.log -d part/access_ --verbose # 按字节大小切割

cat part/access_* > access.log  # 合并
cat part.mp4 >> main.mp4        # 追加 part.mp4 到 main.mp4 末尾
bash -c "cat part.mp4 >> main.mp4" >> /dev/null # 静默执行
查看详情
netnr/ fr-remove-watermark.js 2021-10-19 10:50
fr remove watermark
let wm = {
    startDate: Date.now(),
    remove: () => {
        try {
            document.querySelectorAll('.copyrightInfo-div').forEach(c => {
                c.style.transform = "translateY(9999px)"
            })

            document.querySelectorAll('div').forEach(node => {
                if (node.innerHTML.trim().startsWith("正在试用功能——")) {
查看详情
netnr/ backup_mysql.sh 2021-09-29 15:13
MySQL 备份脚本
# 配置参数(开始)===

ymd=$(date +%Y%m%d)
echo "日期:$ymd"
echo
keepday=5
echo "保留最近天数:$keepday"
echo
dirsync="/package/autosync/sync"
echo "同步目录:$dirsync"
查看详情
netnr/ backup_oracle.sh 2021-09-29 15:10
Oracle 备份脚本
# 配置参数(开始)===

ymd=$(date +%Y%m%d)
echo "日期:$ymd"
echo
keepday=5
echo "保留最近天数:$keepday"
echo
dirsync=/package/autosync/sync
echo "同步目录:$dirsync"
查看详情
netnr/ git-clear-history.sh 2021-08-28 11:54
git 彻底清理历史,仅保留最新一份,慎重操作
cat .git/config  # note <github-uri>
rm -rf .git
git init
git branch -M main # 修改分支,可设置默认分支为 main:  git config --global init.defaultBranch main
git add .
git commit -m "Initial commit"
git remote add origin git@github.com:netnr/proxy.git # 改成自己对应的仓库
git push -u --force origin main
查看详情
netnr/ git-ssh.sh 2021-08-15 06:50
git clone ssh-key
# 设置用户名、邮箱
git config --global user.name "netnr"
git config --global user.email "netnr@netnr.com"

# 查看
cd ~/.ssh && ls

# 生成密钥(ED25519 更小更快更安全,需要 OpenSSH 6.5 以上,推荐),密钥均为 256 位
ssh-keygen -t ed25519 -C "netnr"
查看详情

链接