Skip to content

Instantly share code, notes, and snippets.

View bjwschaap's full-sized avatar
👋
Hi there!

Bastiaan Schaap bjwschaap

👋
Hi there!
View GitHub Profile
@bjwschaap
bjwschaap / main.go
Last active March 7, 2024 00:19
Managing graceful shutdown for multiple echo instances
package main
import (
"context"
"fmt"
"net/http"
"os/signal"
"sync"
"syscall"
"time"
@bjwschaap
bjwschaap / main.go
Created June 16, 2020 06:10
Updater/worker pool idea
package main
import (
"context"
"fmt"
"math/rand"
"sync"
"time"
log "github.com/sirupsen/logrus"
server {
listen 80;
server_name 192.168.33.11;
root /usr/share/nginx/html;
index index.php index.html index.htm;
@bjwschaap
bjwschaap / vary.php
Created February 25, 2019 15:15
Example PHP script
<?php
header('Vary: Accept-Language');
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang) {
case "en":
header('Content-Language: en-US');
echo "Hello World!";
break;
case "nl":
header('Content-Language: nl-NL');

Keybase proof

I hereby claim:

  • I am bjwschaap on github.
  • I am bjwschaap (https://keybase.io/bjwschaap) on keybase.
  • I have a public key whose fingerprint is DF78 DCE0 729D 610D 5453 F6FE AA51 B7C2 0EF9 CAED

To claim this, I am signing this object:

@bjwschaap
bjwschaap / overlay_networking.md
Last active May 11, 2016 22:09
A gist that shows a simple walk-through of inspecting how a Docker overlay network works on the network level

Prerequisites of this lab

First we create 3 ubuntu 14.04 hosts with docker 1.11.1 on them.

We need a KV store to be able to enable multihost/overlay networking in Docker

docker run -d -p 8500:8500 -h consul --name consul progrium/consul -server –bootstrap

Now we need to let our Docker engines know where to find Consul

DOCKER_OPTS="-H tcp://0.0.0.0:2375
-H unix:///var/run/docker.sock
--cluster-store=consul://$MASTER_IP:8500/network \

@bjwschaap
bjwschaap / gist:dab739fef4edb27daa63
Created January 6, 2016 15:44
Wildfly http management API weirdness..
## Digest, as per documentation, no joy..
/# curl -v --digest -u dbxbsc http://localhost:9990/management/ -d '{"operation":"connection-info" }' -HContent-Type:application/json
Enter host password for user 'dbxbsc':
* About to connect() to localhost port 9990 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 9990 (#0)
* Server auth using Digest with user 'dbxbsc'
> POST /management/ HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:9990