Skip to content

Instantly share code, notes, and snippets.

@hitian
hitian / Synology-DSM-Certificate-renew-README.md
Last active February 8, 2026 05:29
DSM ACME Certificate Updater

ACME Certificate Renewal for Synology DSM

This script renews a Let's Encrypt certificate using acme.sh in Docker with Cloudflare DNS, then installs the new certificate into Synology DSM and restarts nginx.

What it does

  • Uses CF_TOKEN and DOMAIN from environment
  • Runs acme.sh to renew and install cert files into the local out directory
  • Copies cert files into DSM's default certificate archive
  • Regenerates DSM web config and restarts nginx
@hitian
hitian / upgrade_gobackup.sh
Created January 2, 2026 04:57
Upgrade gobackup
#!/usr/bin/env bash
set -euo pipefail
echo "Upgrading gobackup..."
curl -sSL https://gobackup.github.io/install | sh
echo "Checking for existing gobackup process..."
# Using || true ensures pgrep doesn't fail script if no processes found
PIDS=$(pgrep -f gobackup || true)
@hitian
hitian / macOS.md
Created April 8, 2023 04:08
macOS command line tips

update screen resolution in esxi

sudo /Library/Application\ Support/VMware\ Tools/vmware-resolutionSet 1920 1080

show all UDP port on macOS

netstat -tulnvp udp
@hitian
hitian / Remove-LeanCloud-App.md
Last active April 8, 2021 17:27
删除LeanCloud

在删除leancloud账号前要求删除所有app

然而不实名认证的情况下无法删除

分析发现页面强制拦截的页面是前端直接限制的,然后你懂的😂

通过API直接操作

浏览器登陆之后直接访问 https://cn-n1-console-api.leancloud.cn/1.1/clients/self/apps 可获取所有app的信息, 找到并记录下app_id, 打开浏览器开发者的网络页签, 提取请求头中的 Cookie 和 X-XSRF-TOKEN (X-XSRF-TOKEN其实就是cookie 中的 XSRF-TOKEN, 没找到可以直接写cookie中的)

@hitian
hitian / Dockerfile
Created August 10, 2019 07:05
docker image for OPENWRT build
FROM ubuntu:latest
#ADD apt.conf /etc/apt/apt.conf
#RUN sed -i -- 's/archive.ubuntu.com/mirrors.163.com/g' /etc/apt/sources.list
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y subversion g++ zlib1g-dev build-essential git python rsync man-db libncurses5-dev gawk gettext unzip file libssl-dev wget zip time mkisofs curl
RUN groupadd -g 1000 tian && \
useradd -r -u 1000 -g tian tian
USER tian
WORKDIR /build
@hitian
hitian / index.html
Created July 15, 2019 06:05
WebSocket demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>websocket client demo</title>
</head>
@hitian
hitian / main.go
Created July 8, 2018 04:21
etcd-go-client-test
package main
import (
"context"
"fmt"
"github.com/coreos/etcd/client"
"log"
"sync"
"time"
)
@hitian
hitian / currency-multi.js
Last active June 17, 2018 16:05
currency for jsbox
/**
* 多国货币转换 for jsbox
* install: https://xteko.com/redir?name=Currency-multi&url=https://gist.githubusercontent.com/hitian/eb5190e9d727272381403a1b918c50e8/raw
*/
$ui.render({
views: [{
type: "label",
props: {
text: "汇率数据获取中..",
@hitian
hitian / Dockerfile
Created June 9, 2018 15:27
aria2c-dockerfile-for-arm32
FROM arm32v6/alpine:latest
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
# export http_proxy=http://192.168.5.15:8080
RUN apk add --no-cache git aria2 darkhttpd && \
mkdir /conf && mkdir /app && mkdir /downloads && \
git clone https://github.com/binux/yaaw.git /app
ADD aria2.conf /conf/aria2.conf
ADD run.sh /run.sh
RUN chmod +x /run.sh
@hitian
hitian / tips.md
Last active October 24, 2016 03:44
tips
docker pull all images

docker images | awk '$1!="REPOSITORY" && $1!="<none>" {print $1}' | xargs -n 1 docker pull

pip update all

pip list -o | awk '{print $1}' | xargs -n 1 pip install --upgrade