sh Git添加除常见配置文件外的所有内容

git-add-all-except.sh
#!/bin/bash
# All all modified files:
git add -u
# Remove common config files:
git reset -- src/main/resources/config/application.yml
git reset -- src/main/resources/config/application-dev.yml
git reset -- src/main/resources/config/application-prod.yml
git reset -- src/main/resources/config/application-tls.yml
git reset -- src/main/resources/config/bootstrap-prod.yml
git reset -- src/main/resources/config/bootstrap.yml

sh Git Clean Workspace

git-clean-workspace.sh
#!/bin/bash
# Undo changes to tracked files with:
git reset HEAD --hard
# Remove untracked files with:
git clean -f
# Remove untracked files and directories with:
git clean -fd
# Remove ignored and untracked files and directories
git clean -fdx

sh 脚本目录

返回脚本所在的目录。

script_dir
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
BASE=${SCRIPT_DIR%/*}

sh ffmpeg信息提取

ffmpeg_info_extraction
ffmpeg -i <input_file>.<ext>-hide_banner

sh Jupyter内核管理

jupyter_kernel
source projectname/bin/activate
pip install ipykernel
ipython kernel install --user --name=projectname
jupyter kernelspec list

sh 计算Pi w / Spark - Cluster

spark_cluster_shell
/opt/mapr/spark/spark-2.4.0/bin/run-example --config spark.master=yarn org.apache.spark.examples.SparkPi 10

sh 庆典-的cheatsheet

保存自https://www.runoob.com/linux/linux-shell-passing-arguments.html

echo.sh
#!/bin/bash
# author:菜鸟教程
# url:www.runoob.com
set -x
echo "Shell 传递参数实例!";
echo "第一个参数为:$1";

echo "参数个数为:$#";
echo "传递的参数作为一个字符串显示:$*";

sh 强制删除页面缓存并触发Linux MM的内存页面压缩程序

cleanup_memory.sh
#!/bin/sh
set -u

NUMA_BEFORE=`numactl -H | grep free:`
SLAB_BEFORE=`grep Normal /proc/buddyinfo`

printf "Dropping page cache..."
sysctl -qw vm.drop_caches=1
echo

printf "Defragmenting memory pages..."
sysctl -qw vm.compact_memory=1
echo

NUMA_AFTER=`numactl -H | grep free:`
SLAB_AFTER=`grep Normal /proc/buddyinfo`

echo
echo "Free memory per NUMA domain:"
echo "Before: " ${NUMA_BEFORE} | tr -s ' ' '\t'
echo "After:  " ${NUMA_AFTER}  | tr -s ' ' '\t'
echo
echo "Slab Allocator status:"
echo "Before: " ${SLAB_BEFORE} | tr -s ' ' '\t'
echo "After:  " ${SLAB_AFTER}  | tr -s ' ' '\t'

sh 重置未推送提交

Git命令从shell重置头部,删除未被推送到源的最后一次提交。

updateSubtree
git reset --hard HEAD^

sh Git设置了ssh

ssh_command.sh
git config core.sshCommand "ssh -i ~/.ssh/id_rsa_example -F /dev/null"