Skip to content

Instantly share code, notes, and snippets.

package main
import (
"container/list"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
@olekukonko
olekukonko / haproxy
Created August 8, 2013 21:30
Different websocket connection HA Proxy vs Nginx
#### HA Proxy
// PROXY BASED ON SUB-DOMAIN
frontend public
bind *:80
acl is_websocket hdr_end(host) -i ws.example.com
use_backend ws if is_websocket
default_backend www
@olekukonko
olekukonko / uuid
Created September 2, 2013 14:41
Simple way to generate UUID in go
package main
import (
"os"
"fmt"
"log"
)
var Random *os.File
package main
import (
"compress/gzip"
"io"
"net/http"
"strings"
)
type gzipResponseWriter struct {
package main
import (
"bufio"
"fmt"
"os"
"time"
)
const numWorkers = 3
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
package main
import (
"flag"
"fmt"
"log"
"net"
)
// Inverse imagecolorat
$rgb = 11840909 ;
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
// Convert To R , G, B
var_dump($r ,$g , $b);
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
package main
import (
"fmt"
"reflect"
)
//function types
type mapf func(interface{}) interface{}