This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
python使用SMTP,发送带附件的邮件代码示例 | |
无需安装依赖 | |
""" | |
import os | |
from smtplib import SMTP | |
from email import encoders | |
from email.mime.base import MIMEBase | |
from email.mime.multipart import MIMEMultipart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* GB2312编码,按汉字使用频率,前3000个既为常用汉字 | |
**/ | |
const decode = new TextDecoder("gb2312"); | |
export default new Set(new Array(3756).fill("").map((_, i) => | |
decode.decode(Uint8Array.from([176 + Math.floor(i / 94), 161 + i % 94])), | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 0. 项目中包含Dockerfile | |
# 1. 设置,指定项目ci模板,如果模板放在公共项目,可以不侵入项目源码 | |
# 2. 设置,配置对应环境变量,公用环境变量设置到项目组,使用gitlab内置变量,比如项目名变量等重写本配置,可能会更加方便 | |
# - CI_REGISTRY_IMAGE registry.example.com/xxxxxx/yyyyy | |
# - REGISTRY registry.example.com | |
# - REGISTRY_USER uuu | |
# - REGISTRY_PASSWORD ppp | |
.build: | |
image: docker:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Script Info] | |
Title: Test | |
Synch Point: 0 | |
ScriptType: v4.00+ | |
Timer: 100.0000 | |
ScaledBorderAndShadow: no | |
YCbCr Matrix: TV.601 | |
WrapStyle: 0 | |
PlayResX: 720 | |
PlayResY: 1280 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 设置账号开机自动登录 | |
# 设置登录后自动运行 | |
# 在启动脚本中执行服务及打开kiosk模式的浏览器 | |
# 关闭锁屏与自动息屏等,也可以在系统设置中手动修改,问题不大 | |
# ubuntu1810以上不再使用unity,需要修改对应脚本,一搜一大把 | |
gsettings set org.gnome.desktop.screensaver lock-enabled false | |
gsettings set org.gnome.desktop.session idle-delay 0 | |
gsettings set org.gnome.desktop.background show-desktop-icons false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. 域名使用第三方服务解析, 总的来说,都差不多,值得注意的是--server参数,最好用的还是letsencrypt | |
# 最终证书路径为 out/xjp.in/fullchain.cer, 私钥为 out/xjp.in/xjp.in.key | |
# 国内访问不了letsencrypt需要加代理 | |
# aliyun 阿里云万网域名解析 | |
docker run --rm \ | |
-v "$(pwd)/out":/acme.sh \ | |
-e Ali_Key='xxxxxx' \ | |
-e Ali_Secret='yyyyyyyyy' \ | |
-e http_proxy=$http_proxy \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 准备文件夹 | |
mkdir ./primary && chmod 777 ./primary | |
# 创建 tsig key, 后续可以用这个key更新dns, 使用nsupdate,javadns等工具 | |
docker run --rm resystit/bind9:latest tsig-keygen xjpinkey | |
# 启动服务 可能本地53已被系统域名解析占用 | |
docker run --rm -d --name my-dns -p 53:53 -p 53:53/udp \ | |
-v `pwd`/named.conf:/etc/bind/named.conf \ | |
-v `pwd`/primary:/etc/bind/primary \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 服务端 | |
export OVPN_DATA=`pwd`/data | |
## 1. 初步构建配置, 这个配置完全不行, 需要再修改route push status等配置 | |
docker run -v `pwd`/data:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig \ | |
-u udp://x.x.x.x \ | |
-s 10.9.0.0/24 \ | |
-n 8.8.8.8 | |
-p "route 172.20.0.0 255.255.0.0" \ | |
-p "route 8.8.8.8 255.255.255.255" \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM alpine:latest | |
ENV TZ=Asia/Shanghai | |
RUN \ | |
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ | |
&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/' /etc/apk/repositories \ | |
&& apk update \ | |
&& apk add --no-cache dumb-init build-base \ | |
&& rm -rf /var/cache/apk/* /usr/share/man /tmp/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 原生API的aes-128-ctr加密算法, | |
* 参数统一使用UnitArray, 加密过程不限于字符串, 浏览器与node端通用 | |
* 使用node的crypto模块与浏览器的window.crypto对象, | |
* IV长度固定为16, | |
* 浏览器不支持aes-256, 故使用aes-128, key长度固定为16, | |
*/ | |
const str2uint = str => new TextEncoder("utf8").encode(str); | |
const uint2str = bf => new TextDecoder("utf8").decode(bf); |
NewerOlder