Skip to content

Instantly share code, notes, and snippets.

View dryaf's full-sized avatar
💭
show me the way to grayskull

dryaf dryaf

💭
show me the way to grayskull
  • secret
  • Austria
View GitHub Profile
@dryaf
dryaf / activate_ssl_rails_dev_puma.sh
Last active April 7, 2022 14:46
Use SSL in Development-Mode in Ruby on Rails 7
# rm -rf config/certs
brew install mkcert
mkdir -p config/certs
mkcert localhost
mv *.pem config/certs
cat << EOF
# for Rails 7, config/puma.rb - replace port ENV.fetch("PORT") { 3000 } with this
if ENV.fetch("RAILS_ENV", "development") == "development"
ssl_bind(
'0.0.0.0',
@dryaf
dryaf / csv2xlsx.go
Last active May 3, 2017 13:30
csv with custom sperator to xlsx converter
package main
import (
"bufio"
"fmt"
"log"
"os"
"github.com/tealeg/xlsx"
"strings"
"path/filepath"
@dryaf
dryaf / simple-gpg-enc.go
Created February 22, 2017 09:41 — forked from stuart-warren/simple-gpg-enc.go
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@dryaf
dryaf / templates.go
Created May 21, 2016 14:51
labstack echo template inheritance recipe
package bla
import (
"io"
"html/template"
"path/filepath"
"strings"
)
// folder structure
@dryaf
dryaf / main.go
Created February 25, 2016 17:54
golang invert png images in current folder
package main
import (
"io/ioutil"
"log"
"github.com/disintegration/imaging"
"image"
"os"
)
@dryaf
dryaf / a_golang_job_queue.md
Created November 10, 2015 18:29 — forked from harlow/golang_job_queue.md
Job queues in Golang
@dryaf
dryaf / sshd.go
Last active August 29, 2015 14:14 — forked from jpillora/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:

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
@dryaf
dryaf / sshd.go
Created July 12, 2014 22:15 — forked from nictuku/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"
@dryaf
dryaf / rails_loginjection.rb
Created March 13, 2011 17:11
(only on intranet webapps) 3.0.5
#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
#