There is a trending 'microservice' library called go-kit. I've been using the go-kit library for a while now. The library provide a lot of convenience integrations that you might need in your service: with service discovery with Consul, distributed tracing with Zipkin, for example, and nice logic utilities such as round robin client side load balancing, and circuit breaking. It is also providing a way to implement communication layer, with support of RPC and REST.
This file contains hidden or 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
| package dnd; | |
| import static elemental2.dom.DomGlobal.document; | |
| import static org.jboss.gwt.elemento.core.EventType.dragend; | |
| import static org.jboss.gwt.elemento.core.EventType.dragover; | |
| import static org.jboss.gwt.elemento.core.EventType.drop; | |
| import com.google.gwt.core.client.EntryPoint; | |
| import com.google.gwt.core.client.GWT; | |
| import elemental2.dom.DataTransfer; |
This file contains hidden or 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
| import com.google.gwt.core.client.EntryPoint; | |
| import com.google.gwt.core.client.GWT; | |
| import elemental2.dom.DataTransfer; | |
| import elemental2.dom.DomGlobal; | |
| import elemental2.dom.DragEvent; | |
| import elemental2.dom.Element; | |
| import elemental2.dom.Event; | |
| import elemental2.dom.EventListener; | |
| import elemental2.dom.File; |
This file contains hidden or 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
| package main | |
| import ( | |
| "log" | |
| "net/http" | |
| "strings" | |
| ) | |
| /* | |
| Returns a map array of all available headers. |
This file contains hidden or 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
| package demo.plain; | |
| import org.keycloak.OAuth2Constants; | |
| import org.keycloak.admin.client.CreatedResponseUtil; | |
| import org.keycloak.admin.client.Keycloak; | |
| import org.keycloak.admin.client.KeycloakBuilder; | |
| import org.keycloak.admin.client.resource.RealmResource; | |
| import org.keycloak.admin.client.resource.UserResource; | |
| import org.keycloak.admin.client.resource.UsersResource; | |
| import org.keycloak.representations.idm.ClientRepresentation; |
This file contains hidden or 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
| var express = require('express'); | |
| var bodyParser = require('body-parser') | |
| var crypto = require('crypto'); | |
| // Calculate the X-Hub-Signature header value. | |
| function getSignature(buf) { | |
| var hmac = crypto.createHmac("sha1", process.env.FB_APP_SECRET); | |
| hmac.update(buf, "utf-8"); | |
| return "sha1=" + hmac.digest("hex"); | |
| } |
This file contains hidden or 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
| // curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload | |
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "net/http" | |
| "os" | |
| "time" |
This file contains hidden or 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
| ## 安裝語系檔 | |
| `$ sudo locale-gen "en_US.UTF-8"` | |
| ## 重新設定語系檔 | |
| `$ sudo dpkg-reconfigure locales` | |
| ## 設定檔 |
This file contains hidden or 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
| package main | |
| import ( | |
| "encoding/json" | |
| "errors" | |
| "database/sql/driver" | |
| "fmt" | |
| "github.com/jmoiron/sqlx" | |
| _ "github.com/lib/pq" | |
| "log" |
This file contains hidden or 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
| #! /usr/bin/env bash | |
| # Install any build dependencies needed for curl | |
| sudo apt-get build-dep curl | |
| # Get latest (as of Feb 25, 2016) libcurl | |
| mkdir ~/curl | |
| cd ~/curl | |
| wget http://curl.haxx.se/download/curl-7.50.2.tar.bz2 | |
| tar -xvjf curl-7.50.2.tar.bz2 |