Skip to content

Instantly share code, notes, and snippets.

View linux-china's full-sized avatar

Libing Chen linux-china

View GitHub Profile
@linux-china
linux-china / ddd.puml
Last active August 29, 2015 14:09
DDD architecture
@startuml
[Infrastructure] #Aqua
[Shared]
note left of Shared : XxxSupport, Utils
package "model package" {
[Model] <<Domain>>
[Repository] <<Domain>>
[Factory] <<Domain>>
@linux-china
linux-china / ddd-maven-modules.puml
Created December 5, 2014 04:02
DDD Maven Modules
@startuml
[client]
package "Domain" {
[core] <<Domain>>
[core-N] <<Domain>>
}
[admin] <<Web>>
[server] <<Web>>
[share]
@linux-china
linux-china / rabbitmq_dag.puml
Created December 23, 2014 04:57
RabbitMQ DAG
@startdot
digraph G
{
pre_boot [shape=doublecircle, style=filled,color=black,fillcolor=green;
pre_boot -> codec_correctness_check;
file_handle_cache -> database;
database -> database_sync;
pre_boot -> file_handle_cache;
pre_boot -> worker_pool;
@linux-china
linux-china / index.jsp
Created December 7, 2012 04:34
Past image from clipboard and upload to your server
<script type="text/javascript">
requirejs([],
function () {
function fillImageContent(imgTag) {
var canvas = document.createElement('canvas');
canvas.width = imgTag.width;
canvas.height = imgTag.height;
var ctx = canvas.getContext('2d');
ctx.drawImage(imgTag, 0, 0);
ctx.fill();
@linux-china
linux-china / Nailgun Servlet
Created March 28, 2013 01:33
Nailgun servlet to start Nailgun server.
import com.martiansoftware.nailgun.NGServer;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
/**
* nailgun servlet
*
* @author linux_china
@linux-china
linux-china / launchItermAndChangeDir.applescript
Last active December 20, 2015 03:59
lauch iTerm and change directory
on run dir
tell application "iTerm"
activate
tell the first terminal
launch session "Default Session"
tell the last session
write text "cd " & dir
end tell
end tell
@linux-china
linux-china / gist:7331933
Last active December 27, 2015 13:18
shorturl with Java. 7位key
public static String[] shortUrl(String url) {
//私钥
String privateKey = "private_key";
//要使用生成URL的字符
String[] chars = new String[]{
"a", "b", "c", "d", "e", "f", "g", "h",
"i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x",
"y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D",
@linux-china
linux-china / demo.puml
Last active April 22, 2016 13:47
PlantUML demo file
@startuml
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Response
Alice -> Bob: Another authentication Request
Alice <-- Bob: another authentication Response
Alice --> Bob: New request
Alice --> Bob: New request 2
@linux-china
linux-china / Routes.java
Created June 8, 2017 05:50
Functional Web Route in Spring 5
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.server.reactive.HttpHandler;
import org.springframework.http.server.reactive.ServletHttpHandlerAdapter;
import org.springframework.web.reactive.config.EnableWebFlux;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.server.adapter.WebHttpHandlerBuilder;
import reactor.core.publisher.Mono;
@linux-china
linux-china / build.gradle
Created June 26, 2017 06:09
build.gradle for Kotlin
buildscript {
ext.kotlin_version = '1.1.3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}