Skip to content

Instantly share code, notes, and snippets.

View raphaelsoul's full-sized avatar
㊗️
Question: why it works? why it not works? why it works after I restart?

Dechen Zhuang raphaelsoul

㊗️
Question: why it works? why it not works? why it works after I restart?
  • China
View GitHub Profile
@raphaelsoul
raphaelsoul / log4j2-config-example.xml
Created September 17, 2017 16:29
just another log4j2 config sample
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="ConsoleStream" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-dd-MM HH:mm:ss,SSS XXX}{GMT+0} [%t] %-5level %logger{36} - %msg%n" />
</Console>
<RollingFile
name="AppStream"
fileName="runtime/logs/app.log"
filePattern="runtime/logs/app-%d{yyyy-MM-dd}.log.gz"
@raphaelsoul
raphaelsoul / webpack.config.js
Created April 4, 2018 01:25
webpack bundle config for backend(typescripted)
const path = require('path');
const nodeExternals = require('webpack-node-externals')
module.exports = {
entry: './src/app.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
@raphaelsoul
raphaelsoul / readme.md
Created June 20, 2018 06:34
结构说明
  • src

    • core // 核心/公共类库
      • app.ts // 暴露一个koa application实例对象 和一个由logjs提供的logger工具类
      • redis.ts // redis client的封装 promisified by bluebird
      • sequelize.ts // 建立数据库链接 实例化数据模型 绑定模型关系
      • (mongoose.ts) // 暂时不在库里
    • middlewares // 抽取公用的中间件,例如上传 权限控制 头部检查 passport封装等
    • models // model层
@raphaelsoul
raphaelsoul / url.md
Created June 21, 2018 02:20
oauth2 design note
0xc3ec90F6475AD5FA990a255844b1B008115f3A95
@raphaelsoul
raphaelsoul / docker-cleanup-resources.md
Last active March 27, 2019 15:42 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@raphaelsoul
raphaelsoul / swarm.yml
Created January 29, 2019 08:00 — forked from MetalArend/swarm.yml
Run a GitLab Runner on your Swarm
version: '3.4'
secrets:
# Find your registration token at: "Your project" > "Settings" > "CI/CD" > "Runners settings" > "Specific Runners" (look for registration token)
# Register it as `GITLAB_REGISTRATION_TOKEN`: `docker secret create GITLAB_REGISTRATION_TOKEN YOUR_REGISTRATION_TOKEN`
GITLAB_REGISTRATION_TOKEN:
external: true
# Find your personal access token at: "Your user account" > "Settings" > "Access Tokens" > "Create personal access token" (for api)
# Register it as `GITLAB_PERSONAL_ACCESS_TOKEN`: `docker secret create GITLAB_PERSONAL_ACCESS_TOKEN <YOUR ACCESS TOKEN>`
@raphaelsoul
raphaelsoul / gen_openssl_cert.sh
Created February 27, 2019 07:41
create a tls cert to protect docker API
openssl genrsa -aes256 -out ca-key.pem 4096
openssl req -new -x509 -days 3650 -key ca-key.pem -sha256 -out ca.pem
openssl genrsa -out server-key.pem 4096
openssl req -subj "/CN=YOUR_IP_ADDR" -sha256 -new -key server-key.pem -out server.csr
echo subjectAltName = DNS:YOUR_IP_ADDR,IP:YOUR_IP_ADDR,IP:127.0.0.1 > extfile.cnf
echo extendedKeyUsage = serverAuth >> extfile.cnf
@raphaelsoul
raphaelsoul / getMiguMethodNames.js
Created March 8, 2019 03:24
migu sdk function names
// get from `Object.keys(window)` in an empty page
const loaded = 'postMessage|blur|focus|close|parent|opener|top|length|frames|closed|location|self|window|document|name|customElements|history|locationbar|menubar|personalbar|scrollbars|statusbar|toolbar|status|frameElement|navigator|origin|external|screen|innerWidth|innerHeight|scrollX|pageXOffset|scrollY|pageYOffset|visualViewport|screenX|screenY|outerWidth|outerHeight|devicePixelRatio|clientInformation|screenLeft|screenTop|defaultStatus|defaultstatus|styleMedia|onanimationend|onanimationiteration|onanimationstart|onsearch|ontransitionend|onwebkitanimationend|onwebkitanimationiteration|onwebkitanimationstart|onwebkittransitionend|isSecureContext|onabort|onblur|oncancel|oncanplay|oncanplaythrough|onchange|onclick|onclose|oncontextmenu|oncuechange|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|ondurationchange|onemptied|onended|onerror|onfocus|oninput|oninvalid|onkeydown|onkeypress|onkeyup|onload|onloadeddata|onloadedmetadata
@raphaelsoul
raphaelsoul / example.js
Created February 28, 2020 05:17
唤醒口袋铃声小程序示例
// 暂时只支持带spinfocode唤醒小程序首页 近期将提供其他页面或url到达能力 届时path参数可能会变
wx.navigateToMiniProgram({
appId: '<APPID>',
path: `pages/index/index`,
extraData: {
spinfocode: '<spinfocode>',
},
envVersion: "release",
success: () => console.log("jump success"),
fail: (e) => console.log("jump failed", e),