Skip to content

Instantly share code, notes, and snippets.

View chih7's full-sized avatar
🎯
Focusing

Chihell chih7

🎯
Focusing
View GitHub Profile
terraform {
required_providers {
tencentcloud = {
source = "tencentcloudstack/tencentcloud"
version = "1.59.14"
}
}
}
provider "tencentcloud" {
[Unit]
Description=Google Drive (rclone)
After=network.target
[Service]
User=chih
Type=simple
ExecStart=/usr/bin/rclone mount gcrypt: /opt/rclone --allow-other --dir-cache-time 24h --drive-chunk-size 32M --timeout 1h --umask 002
ExecStop=/usr/bin/fusermount -uz /opt/rclone
Restart=always
DAVLockDB /home/httpd/DAV/DAVLock
<VirtualHost *:8080>
Alias /webdav /opt/rclone/webdav
<Directory /opt/rclone/webdav>
DAV On
AllowOverride None
AddDefaultCharset utf-8
IndexOptions Charset=utf-8
IndexOptions NameWidth=*
#! /bin/bash
for i in $(pacman -Qq)
do
grep -e "\[ALPM\] installed $i" -e "\[ALPM\] upgraded $i" /var/log/pacman.log | \
sort -u -r | \
head -1
done | \
sort -u | \
sed -e 's/\[ALPM\] installed //' -e 's/(.*$//' | \
@chih7
chih7 / ssh_port_forward.sh
Last active February 27, 2019 08:56
create an SSH connection on your local computer that securely forwards to the localhost connection
ssh -4 -L 0.0.0.0:8080:127.0.0.1:8080 -N -f -l chih 192.168.122.44
start(){
printf 'Starting the server\n'
pids=`getPid $APPID`
if ! [ -z "$pids" ];then #如果进程已经存在 -z 表示判空
printf 'Existing process: %d\n' "$pids"
retval=1
else #如果进程不存在
#start
/bin/su $USER -c "mkdir -p $PROJECT_DIR/temp/" # 使用su切换到USER变量定义的用户,并执行命令mkdir,创建目录
/bin/su $USER -c "mkdir -p $PROJECT_DIR/logs/"
#!/bin/bash
while [[ true ]] ; do
# performs synchronizations / copy
rclone sync ....
# waiting for something to change or it will pass 300 seconds
inotifywait --recursive --timeout 300 -e modify,delete,create,move SRC_DIR
# 在 nat 表中创建新链
iptables -t nat -N SHADOWSOCKS
# 跳过 shadowsocks 代理服务器
iptables -t nat -A SHADOWSOCKS -p tcp --dport <远程主机端口> -j RETURN
iptables -t nat -A SHADOWSOCKS -d <远程主机 IP> -j RETURN
# 跳过本地 IP 段
iptables -t nat -A SHADOWSOCKS -d 0.0.0.0/8 -j RETURN
iptables -t nat -A SHADOWSOCKS -d 10.0.0.0/8 -j RETURN
➜ system cat certbot.service
[Unit]
Description=Let's Encrypt renewal
[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos --deploy-hook "systemctl reload nginx.service"
➜ system cat certbot.timer
@chih7
chih7 / qemu 启动
Last active December 20, 2018 07:55
sudo qemu-system-x86_64 --enable-kvm -m 2048 -cpu host -smp 4 -netdev tap,id=t0,ifname=virbr0-nic,script=no,downscript=no -device e1000,netdev=t0,id=nic0 --nographic -vnc 0.0.0.0:1 -k en-us ubuntu16.04-2.qcow2