Skip to content

Instantly share code, notes, and snippets.

View simonkuang's full-sized avatar

Simon Kuang simonkuang

  • Chengdu, P.R.China
View GitHub Profile
@simonkuang
simonkuang / acme_ssl.sh
Created April 10, 2026 03:48
acme_ssl 函数,方便通过 acme.sh 注册证书
# acme.sh ssl function
acme_ssl() {
# ------------------------
# Configurable variables
# ------------------------
ACME_BIN="/root/.acme.sh/acme.sh"
WEBROOT="/usr/local/openresty/nginx/html"
CERT_DIR="/usr/local/openresty/nginx/conf/ssl"
# DOCKER_CONTAINER="openresty"
# RELOAD_CMD="/usr/bin/docker exec ${DOCKER_CONTAINER} /usr/local/openresty/nginx/sbin/nginx -t && \
@simonkuang
simonkuang / Dockerfile
Last active July 6, 2025 11:59
自己构建一个 Openresty docker,给 openresty 加上 njs 的命令。
FROM openresty/openresty:bookworm-fat AS builder
USER root
ARG OPENRESTY_VERSION="1.27.1.2"
ARG NGINX_VERSION="1.27.1"
ARG IN_GFW
COPY misc/gfw.sh /root/docker-gfw.sh
# https://huggingface.co/h2oai/h2o-danube3-4b-chat
yes | conda create -n h2oai python=3.11.9
conda activate h2oai
apt update
apt install -y tmux vim curl htop git aria2
pip install -U pip
pip install -U "transformers>=4.42.3" torch accelerate sentencepiece protobuf
@simonkuang
simonkuang / README.md
Last active November 5, 2023 14:57
Basic Auth
  • cut: 取出user.txt的第二个字段(密码明文),将结果输出到stdout;
  • openssl: 将stdin中输入的数据(3条密码明文)使用SHA512形式进行hash,输出到stdout;
  • paste: 将user.txt中的原始内容与hash过的密码组合起来,输出到stdout;
  • tr: 去除可能出现的\r符号;
  • awk: 从stdin中提取出用户名、hash过的密码、注释字段,将结果输出到passwd.txt。

OpenSSL 的帮助命令可以看出当前的 openssl 命令支持哪些加密方式。

@simonkuang
simonkuang / .Cloud.md
Created October 23, 2023 16:28 — forked from imba-tjd/.Cloud.md
☁️ 一些免费的云资源

IaaS指提供系统(可以自己选)或者储存空间之类的硬件,软件要自己手动装;PaaS提供语言环境和框架(可以自己选);SaaS只能使用开发好的软件(卖软件本身);BaaS一般类似于非关系数据库,但各家不通用,有时还有一些其它东西。

其他人的集合

@simonkuang
simonkuang / cdn-mirror.conf
Created October 11, 2023 16:20
代理 discord cdn 的 openresty 配置
server {
listen 8080;
resolver 8.8.8.8;
location ~* ^/cdn/discordapp/(.*)$ {
proxy_set_header Host 'cdn.discordapp.com';
proxy_set_header Accept-Encoding $http_accept_encoding;
proxy_pass https://cdn.discordapp.com/$1;
}
@simonkuang
simonkuang / install.sh
Last active September 1, 2023 14:03
install stable-diffusion-webui in Ubuntu
#!/bin/bash
mkdir -p /data/workspace
cd /data/workspace
env PYTHONDONTWRITEBYTECODE=1
apt-get -y install -qq aria2
apt-get -y install -qq libcairo2-dev
apt-get -y install -qq python3-dev
@simonkuang
simonkuang / reveal.html
Created November 25, 2021 02:39
reveal.js online startup template
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/hakimel/reveal.js@master/dist/reset.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/hakimel/reveal.js@master/dist/reveal.css">
@simonkuang
simonkuang / docker-compose.yml
Created July 27, 2021 08:54
quickly deploy a mongo cluster with replicaset
version: '2'
services:
## Router
router01:
image: mongo:4.2
container_name: rydell-router-01
command: mongos --port 27017 --configdb rs-config-server/configsvr01:27017,configsvr02:27017,configsvr03:27017 --bind_ip_all
ports:
- 27117:27017
@simonkuang
simonkuang / init-composer-in-docker.sh
Last active April 28, 2021 06:59
Init composer environment in container.
yum install -y dnf dnf-core-plugins
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s/#baseurl/baseurl/g"
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s/mirrorlist/#mirrorlist/g"
find /etc/yum.repos.d/ -name "remi*.repo" | xargs sed -i "s@http://rpms.remirepo.net@https://mirrors.tuna.tsinghua.edu.cn/remi@g"
dnf install -y php74-php php74-php-pear php74-php-cli php74-php-pecl-zip unzip \
php74-php-gd php74-php-dba php74-php-dbg php74-php-fpm php74-php-gmp php74-php-pdo \
php74-php-xml php74-php-imap php74-php-json php74-php-devel php74-php-bcmath \
php74-php-pgsql php74-php-sodium php74-php-xhprof php74-php-mysqlnd php74-php-process \