This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# http://dwz.cn/paoFnZPv | |
# Set the keyboard layout | |
loadkeys us && | |
# Update the system clock | |
timedatectl set-ntp true && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Warning! This script will remove all local branches that not tracking remote branches. | |
git fetch --prune | |
echo "*******" | |
echo "Branches to remove:\n" | |
# TODO Reuse code and unify solution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Switcher of shell proxy. | |
# Shell proxy | |
function shell-proxy(){ | |
if [ "$1" = "on" ]; then | |
echo "Turning on shell proxy..." | |
export ALL_PROXY=socks5://127.0.0.1:1080 | |
elif [ "$1" = "off" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, put this on the bottom of your .zshrc . | |
# And then, you need to create a directory named ".zshrcs" in your home directory. | |
# Finally, you can create each shell script files into .zshrcs directory. Scripts which you wanted to append at the end of .zshrc before. | |
# Source all scripts in ~/.zshrcs/ | |
for f in ~/.zshrcs/*; do source $f; done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# The first argument is the list file. | |
count=4 | |
all='' | |
echo "Start to ping all the servers..." | |
for ip in `cat $1` | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Shadowsocks Server | |
After=network.target | |
[Service] | |
ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/ss-config.json | |
Restart=on-abort | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
for url in `curl --silent https://api.github.com/repos/$1/releases/latest | awk '/browser_download_url/ { print $2 }' | sed 's/"//g'` | |
do | |
echo $url | |
curl -LOk $url | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ProjectName="sundries" # 项目名称 | |
Port=3030 # 服务监听端口 , 通过设置 NODE_PORT 环境变量实现 | |
CleanNodeModules=true # 是否每次都清除 node_modules | |
NodeVersion=8.1.2 # node 版本, 需确保 nvm 有该版本 | |
Restart=true # 是否每次都重启服务 | |
if [[ -e $1 ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Use common shell. Or edit this for whatever shell you love. | |
# This is for building Spigot server for Minecraft game. | |
# This is a common script. You can use this directly, or customize for your own. | |
# Require Java 8+ and Git. | |
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && | |
java -jar BuildTools.jar | |
# Or add --dev for building development version Spigot: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Renews letsencrypt certificates | |
After=network.target | |
[Service] | |
Type=oneshot | |
WorkingDirectory=/etc/letsencrypt | |
ExecStart=/usr/bin/certbot renew --quiet --agree-tos --pre-hook "systemctl stop nginx.service" --post-hook "systemctl restart nginx.service" |