[TOC]
截止 10 Apr, 2020 ,
微信小程序的云函数仅支持 Node.js 语言,函数在生产环境执行于 CentOS 7.2
的 Node.js 8.9
,因此若有二进制模块使用需求请注意相关配置。
现以 gRPC 为例说明。
#! /usr/bin/env zsh | |
# Ref: https://github.com/creationix/nvm#calling-nvm-use-automatically-in-a-directory-with-a-nvmrc-file | |
# place this after nvm initialization! | |
autoload -Uz add-zsh-hook | |
# Function: load-nvmrc | |
load-nvmrc() { | |
local _CUR_NODE_VER="$(nvm version)" |
#!/bin/bash | |
CN_DNS="182.254.116.116" # DNSPod Shenzhen | |
CN_DNS_2="114.114.114.114" # 114DNS | |
cat dnsmasq.conf | grep -v '^#' | sed -e "s|^server=/\([^0-9].*\)/[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}$|forward-zone:\n\tname: \"\1\"\n\tforward-addr: ${CN_DNS}\n\tforward-addr: ${CN_DNS_2}\n\tforward-first: yes|g" -e "s|^address=/\([^0-9].*\)/\([0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}\)$|local-zone: \"\1 A \2\"|g" > unbound.conf |
#!/bin/bash | |
mkdir -p ~/ppappinstaller/Library/LaunchDaemons ~/ppappinstaller/usr/bin ~/ppappinstaller/usr/local | |
sudo launchctl unload /Library/LaunchDaemons/com.apple.globalupdate.plist | |
sudo mv /Library/LaunchDaemons/com.apple.globalupdate.plist ~/ppappinstaller/Library/LaunchDaemons | |
sudo mv /usr/bin/globalupdate ~/ppappinstaller/usr/bin | |
sudo launchctl unload /Library/LaunchDaemons/com.apple.itunesupdate.plist | |
sudo mv /Library/LaunchDaemons/com.apple.itunesupdate.plist ~/ppappinstaller/Library/LaunchDaemons | |
sudo mv /usr/bin/itunesupdate ~/ppappinstaller/usr/bin |
[ | |
{ | |
"name":"Accelerate the loading of static resources with China Unicom CDNs (http://120.52.72.*/)", | |
"match":{ | |
"str":"^http:\\/\\/(?!(120\\.52\\.72\\.\\d+)).*\\/.*\\.(?:manifest|appcache|html?|xml|json|jpe?g|gif|png|webp|ico|cur|gz|svgz?|mp4|ogg|ogv|webm|htc|css|js|txt|ttf|ttc|otf|eot|woff2?)(?:\\?|#|$)", | |
"type":0, | |
"modi":true | |
}, | |
"sub":{ | |
"str":"^http:\\/\\/(.*)$", |