Skip to content

Instantly share code, notes, and snippets.

@lilac
lilac / readme.md
Last active March 15, 2020 07:29
Kiss

Introduction

Kiss (keep it simple server), is a simple micro service toolkit, with batteries included to ship it to production with no effort.

Goals

  • Simple

    Simple to understand, and easy to start.

  • Production ready

@lilac
lilac / Dockerfile
Created September 29, 2019 03:25
Run nginx on cloud run
FROM nginx
# COPY nginx.conf /etc/nginx/conf.d/default.conf
ADD run-nginx.sh .
CMD ["bash", "run-nginx.sh"]
@lilac
lilac / sbt-repositories.ini
Last active September 15, 2019 11:21
墙内使用sbt的配置
[repositories]
#本地源
local
# repox-ivy: http://repox.gtan.com:8078/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
# repox-maven: http://repox.gtan.com:8078/
aliyun: http://maven.aliyun.com/nexus/content/groups/public/
#添加国外源备用
typesafe-ivy: https://dl.bintray.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
jboss-repository: http://repository.jboss.org/nexus/content/groups/public/
sbt: https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
@lilac
lilac / json.scala
Created June 5, 2019 13:00
Json type in Dotty
case class Obj(val elems: (String, json)*) derives Eql
case class Arr(val elems: json*)
type json = Number | String | Obj | Arr
val s: json = Obj("a" -> 3, "b" -> "cd", "ar" -> Arr(1, "abc"))
println(s)
@lilac
lilac / rpc.md
Last active April 16, 2019 08:32
RPC系统需求

一个好的远程调用服务(PRC)应该支持以下特性

  1. 服务发现
  2. 负载均衡(可配置策略)
  3. 限流(熔断)
  4. 鉴权
  5. 调用策略(重试,降级)
  6. 分布式追踪与性能监控
@lilac
lilac / issues.graphql
Last active April 15, 2019 02:24
List issues (with comments) of a repository
{
repository(name: "996.ICU", owner: "996icu") {
id
issues(first: 50) {
totalCount
nodes {
id
title
body
bodyText
@lilac
lilac / maven-dep-tree.sh
Created April 9, 2019 05:59
Inspect maven dependency tree of a specific library
mvn dependency:tree -Dverbose -Dincludes=com.google.guava
@lilac
lilac / makeTemplate.js
Created March 29, 2018 12:11 — forked from malko/makeTemplate.js
dynamic es6 template string to template methods
//const tpl = makeTemplate('hello ${name}')
//const name = 'world';
//tpl({name});
const makeTemplate = (templateString) => {
return (templateData) => new Function(`{${Object.keys(templateData).join(',')}}`, 'return `' + templateString + '`')(templateData);
}
@lilac
lilac / messages.md
Last active January 22, 2018 12:50
登顶大会新方案消息设计

玩家的回答

{
  "type": "answer",
  "payload": {
    "$question_id": "A" // 问题id -> 选项
  }
}