sh 安装Wordpress

mysql_init.sh
#!/bin/bash

CREATE DATABASE IF NOT EXISTS wordpress default charset utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@"%" identified by 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@"localhost" identified by 'password';
FLUSH PRIVILEGES;

sh 跑得扑朔迷离

run flutter
flutter run

sh 创建项目

create project
flutter create projectName

sh Conda修订版

将您的Anaconda发行版回滚到早期版本

conda_revisions
# 
# Source: http://blog.rtwilson.com/conda-revisions-letting-you-rollback-to-a-previous-version-of-your-environment/


# Changes to Anaconda distribution and packages

conda list --revisions

# Revert to a previous revision

conda install --revision N # where N is the revision number

sh GIT - 在推送前检查与原点的差异。要运行的SQL

checkSQLBeforePush
git diff origin/qa3 --name-only

sh 列出过程死亡人数

list_decendents
list_descendants() {
  children=$(ps -o pid= --ppid "$1")
  echo ${children}

  for pid in $children; do
    list_descendants "$pid"
  done
  echo ${children}
}

sh 利用coding.net批量更新本地所有仓库

保存自https://gist.github.com/liangzai-cool/1a2db7d48e8356e8e947e477dc744cc9

coding.net.sh
source_code_dir="/Users/username/sourcecode/dev.tencent.com/"
token="your_coding_net_token"
current_dir=$(pwd)
response=$(curl -X GET "https://coding.net/api/user/projects?type=all&sort=&page=1&pageSize=100" -H "Authorization: token ${token}")
project_count=$(echo $response | jq '.data.list | length')
echo $project_count
for(( i = 0; i < $project_count; i = i + 1 ))
do
  operation="clone"
  item=$(echo $response | jq -r ".data.list[$i]")
  name=$(echo $item | jq -r ".name")
  owner_user_name=$(echo $item | jq -r ".owner_user_name")
  ssh_url=$(echo $item | jq -r ".ssh_url")
  if [ -d "$source_code_dir$owner_user_name/$name/.git" ]; then
    echo "$source_code_dir$owner_user_name/$name/.git 存在"
    operation="pull"
  else 
    echo "$source_code_dir$owner_user_name/$name/.git 不存在"
  fi
  echo "正在 $operation 项目:$ssh_url"
  if [ $operation = "clone" ]; then
    git clone $ssh_url "$source_code_dir$owner_user_name/$name"
  else
    cd "$source_code_dir$owner_user_name/$name"
    git pull
    cd $current_dir
  fi
  echo -e "完成 $operation 项目:$ssh_url\n"
done 

sh coding.net所有仓库同步到GitHub的私有仓库

保存自https://gist.github.com/liangzai-cool/ec8cf14866b6e9c27210ec28273b83af

coding.net-2-github.com.sh
source_code_dir="/Users/username/sourcecode/dev.tencent.com/"
token="your_coding_net_token"
gh_token="your_github_com_token"
current_dir=$(pwd)
response=$(curl -X GET "https://coding.net/api/user/projects?type=all&sort=&page=1&pageSize=100" -H "Authorization: token ${token}")
project_count=$(echo $response | jq '.data.list | length')
echo $project_count
for(( i = 0; i < $project_count; i = i + 1 ))
do
  operation="clone"
  item=$(echo $response | jq -r ".data.list[$i]")
  name=$(echo $item | jq -r ".name")
  description=$(echo $item | jq -r ".description")
  owner_user_name=$(echo $item | jq -r ".owner_user_name")
  ssh_url=$(echo $item | jq -r ".ssh_url")
  project_local_dir="$source_code_dir$owner_user_name/$name"
  if [ -d "$project_local_dir/.git" ]; then
    echo "$project_local_dir/.git 存在"
    operation="pull"
  else 
    echo "$project_local_dir/.git 不存在"
  fi
  echo "正在 $operation 项目:$ssh_url"
  if [ $operation = "clone" ]; then
    git clone $ssh_url "$project_local_dir"
  else
    cd "$project_local_dir"
    git pull
    cd $current_dir
  fi
  echo -e "完成 $operation 项目:$ssh_url\n"
  create_repo_response=$(curl --request POST \
  --url https://api.github.com/user/repos \
  --header "Authorization: token $gh_token" \
  --header "cache-control: no-cache" \
  --data "{\"name\": \"$name\", \"description\": \"$description\", \"private\": true}")
  errors_length=$(echo $create_repo_response | jq -r ".errors | length")
  if [ $errors_length = 0 ]; then
    echo "仓库创建成功:$name"
    gh_ssh_url=$(echo $create_repo_response | jq -r ".ssh_url")
    cd $project_local_dir
    git remote add github $gh_ssh_url
    git push github --all
    echo "创库推送成功:$name"
  else
    echo "仓库创建失败:$name,$create_repo_response"
  fi
  echo -e "完成同步项目:$name\n"
done 

sh gitee.com所有仓库同步到GitHub的私有仓库

保存自https://gist.github.com/liangzai-cool/2835f1b94fd24a9385354dd5120eff2b

gitee.com-2-github.com.sh
source_code_dir="/Users/username/sourcecode/gitee.com/"
token="your_gitee_com_token"
gh_token="your_github_com_token"
current_dir=$(pwd)
response=$(curl -X GET "https://gitee.com/api/v5/user/repos?access_token=${token}&sort=created&page=1&per_page=20")
project_count=$(echo $response | jq '. | length')
echo $project_count
for(( i = 0; i < $project_count; i = i + 1 ))
do
  operation="clone"
  item=$(echo $response | jq -r ".[$i]")
  name=$(echo $item | jq -r ".name")
  description=$(echo $item | jq -r ".description")
  owner_user_name=$(echo $item | jq -r ".owner.name")
  ssh_url=$(echo $item | jq -r ".ssh_url")
  project_local_dir="$source_code_dir$owner_user_name/$name"
  if [ -d "$project_local_dir/.git" ]; then
    echo "$project_local_dir/.git 存在"
    operation="pull"
  else 
    echo "$project_local_dir/.git 不存在"
  fi
  echo "正在 $operation 项目:$ssh_url"
  if [ $operation = "clone" ]; then
    git clone $ssh_url "$project_local_dir"
  else
    cd "$project_local_dir"
    git pull
    cd $current_dir
  fi
  echo -e "完成 $operation 项目:$ssh_url\n"
  create_repo_response=$(curl --request POST \
  --url https://api.github.com/user/repos \
  --header "Authorization: token $gh_token" \
  --header "cache-control: no-cache" \
  --data "{\"name\": \"$name\", \"description\": \"$description\", \"private\": true}")
  errors_length=$(echo $create_repo_response | jq -r ".errors | length")
  if [ $errors_length = 0 ]; then
    echo "仓库创建成功:$name"
    gh_ssh_url=$(echo $create_repo_response | jq -r ".ssh_url")
    cd $project_local_dir
    git remote add github $gh_ssh_url
    git push github --all
    echo "创库推送成功:$name"
  else
    echo "仓库创建失败:$name,$create_repo_response"
  fi
  echo -e "完成同步项目:$name\n"
done 

sh 更新LinVST SimLinks

更新LinVST SimLinks

update-linvst-simlink.sh
#!/bin/bash
find Plugins\ VST/ -type f -name *.so -exec cp /usr/share/LinVst/64bit-32bit/linvst.so {} \;
find Plugins\ VST/Jack\ Sparrow/ -type f -name *.so -exec cp -v /usr/share/LinVst/64bit-32bit/linvst.so {} \;