Skip to content

Instantly share code, notes, and snippets.

View simonkuang's full-sized avatar

Simon Kuang simonkuang

  • Chengtu, P.R.China
View GitHub Profile
@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 \
@simonkuang
simonkuang / remarkjs_with_MathJax.html
Created March 29, 2021 06:12 — forked from pinbo/remarkjs_with_MathJax.html
Remark.js+MathJax essentials
<!DOCTYPE html>
<html>
<head>
<title>My Presentation</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
.red { color: red }
</style>
</head>
<body>
@simonkuang
simonkuang / any_proxy.conf
Created August 28, 2020 06:58
用另一个域名代理某个域名的 openresty 配置规则。
server {
listen 443 ssl;
listen 80;
server_name pbs.a-domain.com abs.a-domain.com abs-0.a-domain.com;
server_tokens off;
resolver 8.8.8.8 1.1.1.1 9.9.9.9 8.8.4.4;
ssl_certificate ssl/a-domain.com.crt;
ssl_certificate_key ssl/7a-domain.com.key;
@simonkuang
simonkuang / report_ip.py
Created May 26, 2020 06:02
获取本地 IP 并上报服务器。用于内网环境服务器重启后,IP 变化,无法远程的场景。上报服务器最好是固定 IP 并提供 http 服务。可用 pyinstaller 打包。
# -*- coding: utf-8 -*-
import os
import socket
import time
import urllib
import urllib.parse
import urllib.request
from pprint import pprint as pp