Instantly share code, notes, and snippets.

💭
show me the way to grayskull

randy rand99

  • none
  • Austria
View GitHub Profile
View csv2xlsx.go
package main
import (
"bufio"
"fmt"
"log"
"os"
"github.com/tealeg/xlsx"
"strings"
"path/filepath"
View simple-gpg-enc.go
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
View templates.go
package bla
import (
"io"
"html/template"
"path/filepath"
"strings"
)
// folder structure
View main.go
package main
import (
"io/ioutil"
"log"
"github.com/disintegration/imaging"
"image"
"os"
)
View a_golang_job_queue.md
View sshd.go
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
View benchmark+go+nginx.md

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
View sshd.go
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
View rails_loginjection.rb
#Encoding: UTF-8
#
# Log-File-Injection - Ruby on Rails 3.05
# possibilities:
# - possible date back attacks (tried with request-log-analyzer: worked but teaser_check_warnings)
# - ip spoofing
# - terminal injection
# - binary log-injections
# - DOS if ip is used with an iptables-ban-script
#
View gist:843665
role admin sA
subject / rvka
/ rwcdmlxi
role default
subject / {
/ h
-CAP_ALL
connect disabled
bind disabled