Skip to content

Instantly share code, notes, and snippets.

View libook's full-sized avatar
🎵
Never Gonna Give You Up~

Daniel Li libook

🎵
Never Gonna Give You Up~
View GitHub Profile
@libook
libook / archlinux-gnome-install-cd.sh
Last active August 25, 2018 04:56
Arch Linux with Gnome installation
#!/usr/bin/env zsh
# http://dwz.cn/paoFnZPv
# Set the keyboard layout
loadkeys us &&
# Update the system clock
timedatectl set-ntp true &&
@libook
libook / remove-abandoned-branch
Created June 7, 2018 02:54
Remove abandoned branch
#!/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.
#!/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
@libook
libook / .zshrc
Created August 8, 2017 10:35
New designing of "rc" files.
# 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
@libook
libook / batch-ping.sh
Created August 8, 2017 10:13
Finding best server with pinging a list.
#!/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
@libook
libook / shadowsocks-server.service
Created August 8, 2017 03:50 — forked from guyskk/shadowsocks-server.service
shadowsocks server systemd service
[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
@libook
libook / github-latest-release.sh
Last active May 3, 2018 15:51 — forked from 0xadada/github-latest-release.sh
Download latest GitHub project release
#!/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
@libook
libook / runService.sh
Created July 24, 2017 06:27 — forked from Chunlin-Li/runService.sh
项目启动脚本 (10.8.8.8 使用)
#!/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
@libook
libook / 0_0build-spigot.sh
Last active May 5, 2018 07:33
Building Spigot, Bukkit and Craftbukkit server for Minecraft.
#!/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:
@libook
libook / letsencrypt-nginx.service
Created July 23, 2017 17:05
Systemd service for Let's Encrypt.
[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"