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 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
WITH RECURSIVE fizz_buzz (sequence, modulo_3, modulo_5) AS ( | |
SELECT 1, CAST('' AS CHAR(4)), CAST('' AS CHAR(5)) | |
UNION ALL | |
SELECT sequence + 1, | |
IF(MOD(sequence + 1, 3) = 0, 'Fizz', ''), | |
IF(MOD(sequence + 1, 5) = 0, 'Buzz', '') | |
FROM fizz_buzz | |
WHERE sequence < 100 | |
) |
This file contains 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
FROM alpine | |
COPY configure-node.sh configure-node.sh | |
CMD ["/bin/sh", "configure-node.sh"] |
This file contains 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 ( | |
"bytes" | |
"flag" | |
"golang.org/x/net/websocket" | |
"io" | |
"k8s.io/client-go/1.4/rest" | |
"k8s.io/client-go/1.4/tools/clientcmd" | |
"log" |
This file contains 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
server { | |
listen {PUBLIC-GITLAB-HTTP-PORT}; #e.g. 80 | |
server_name {PUBLIC-GITLAB-HOST}; #e.g. git.mycompany.com | |
# add_header X-Frame-Options DENY; | |
add_header X-Content-Type-Options nosniff; | |
location / { | |
## Hack to implement && - Concat two strings and compare result | |
if ($args ~* "^go-get=1") { | |
set $condition goget; | |
} |
This file contains 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 security | |
import ( | |
"encoding/base64" | |
"net/http" | |
"strings" | |
) | |
// BasicAuth Middleware with next handler in chain | |
type BasicAuth struct { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains 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
<?php | |
/** | |
* The Router class is a fast and lightweight router (yes it is). It can handle | |
* a path and call the matching controller. If there is no match, then an | |
* exception will be throwned. | |
* | |
* ...and it fits in a tweet. | |
* | |
* @author Quentin Schuler aka Sukei <qschuler@neosyne.com> |
This file contains 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
<?php | |
/** | |
* The Container class is a lightweight service container. | |
* | |
* ...and it fits in a tweet. | |
* | |
* @author Quentin Schuler aka Sukei <qschuler@neosyne.com> | |
*/ | |
class Container{private $s;function set($k,$c){$this->s[$k]=$c;}function get($k){return(is_a($v=$this->s[$k],'Closure'))?$v($this):$v;}} |
NewerOlder