Skip to content

Instantly share code, notes, and snippets.

set -g default-terminal "screen-256color"
set-option -g default-shell $SHELL
# Set the Bind Key
#unbind C-b
#set -g prefix `
#bind-key ` send-prefix
#bind-key L last-window
# force a reload of the config file
#!/bin/bash
tee /root/init_config <<EOF
{
"ListenAddr": "0.0.0.0:2377",
"AdvertiseAddr": "$1:2377",
"ForceNewCluster": true,
"Spec": {
"Orchestration": {},
"Raft": { "KeepOldSnapshots": 1000000 },
"Dispatcher": {},
@neverlock
neverlock / nginx-tuning.md
Created October 16, 2016 15:05 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@neverlock
neverlock / join.sh
Created July 23, 2016 06:32
join swarm cluster
#!/bin/bash
for d in `docker-machine ls --format "{{.Name}}"`; do docker-machine ssh $d docker swarm join --secret d0cker_swarm_2k 104.236.18.183:2377; done
@neverlock
neverlock / vultrprovision.sh
Created July 23, 2016 06:25
vultr provisioning
#!/bin/bash
API="your Vultr API Key"
SSHKEY_ID="56f16af463228"
#OS_ID="193" #debian 8 64
OS_ID="215" #ubuntu 1604 64
REGION_ID="25" #jp
PLAN_ID="29" #5$
LABEL="neverlock-"
MAX=10
for i in `seq 1 $MAX`
@neverlock
neverlock / docker-machine.sh
Created July 23, 2016 06:19
install docker-machine with vultr driver
#!/bin/bash
curl -L https://github.com/docker/machine/releases/download/v0.7.0/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine && \
chmod +x /usr/local/bin/docker-machine
curl -L https://github.com/janeczku/docker-machine-vultr/releases/download/v1.0.7/docker-machine-driver-vultr-v1.0.7-linux-amd64.tar.gz > /tmp/docker-machine-driver-vultr-v1.0.7-linux-amd64.tar.gz
tar xvfz /tmp/docker-machine-driver-vultr-v1.0.7-linux-amd64.tar.gz -C /usr/local/bin
chmod +x /usr/local/bin/docker-machine-driver-vultr
@neverlock
neverlock / set_cookiejar.go
Created July 21, 2016 06:33 — forked from HugoPresents/set_cookiejar.go
golang set cookieJar example
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
)
@neverlock
neverlock / multipart_upload.go
Created April 5, 2016 07:54 — forked from mattetti/multipart_upload.go
Example of doing a multipart upload in Go (golang)
package main
import (
"bytes"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"os"
@neverlock
neverlock / ssl_smtp_example.go
Created January 12, 2016 04:51 — forked from chrisgillis/ssl_smtp_example.go
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@neverlock
neverlock / sendMail.go
Created January 12, 2016 04:45 — forked from andelf/sendMail.go
golang send mail net/smtp SMTP
package main
import (
"log"
"net/mail"
"encoding/base64"
"net/smtp"
"fmt"
"strings"