View groupcache.go
// Simple groupcache example: https://github.com/golang/groupcache
// Running 3 instances:
// go run groupcache.go -addr=:8080 -pool=http://127.0.0.1:8080,http://127.0.0.1:8081,http://127.0.0.1:8082
// go run groupcache.go -addr=:8081 -pool=http://127.0.0.1:8081,http://127.0.0.1:8080,http://127.0.0.1:8082
// go run groupcache.go -addr=:8082 -pool=http://127.0.0.1:8082,http://127.0.0.1:8080,http://127.0.0.1:8081
// Testing:
// curl localhost:8080/color?name=red
package main
import (
View freegeoip-httpmux.go
package main
import (
"bytes"
"encoding/csv"
"encoding/json"
"encoding/xml"
"fmt"
"log"
"math/rand"
View round-int
func RoundUp(v int) int {
return 10 * ((v + 9) / 10)
}
func RoundDown(v int) int {
return 10 * (v / 10)
}
View website-screenshot.py
#!/usr/bin/env python
import sys
import time
from getopt import getopt
from PIL import Image
from selenium import webdriver
View tehcloud.go
package main
import (
"flag"
"log"
"os"
"os/exec"
"strings"
"github.com/nlopes/slack"
View go-yeah.go
package main
import (
"flag"
"io"
"net/http"
"os"
"strings"
"github.com/gorilla/handlers"
View proxy.go
package main
import (
"io"
"net/http"
"strings"
)
func main() {
p := &proxy{}
View sse.go
// Go and Server Sent Events for HTTP/1.1 and HTTP/2.0
//go:generate go run $GOROOT/src/crypto/tls/generate_cert.go -host localhost
package main
import (
"fmt"
"io"
"log"
"net/http"
View ipcontinent.go
package main
import (
"flag"
"fmt"
"log"
"math/rand"
"net"
"net/url"
"os"
View OAuth2.md

OAUTH2

The Problem

I’m a web app that wants to allow other web apps access to my users’ information, but I want to ensure that the user says it’s ok.

The Solution

I can’t trust the other web apps, so I must interact with my users directly. I’ll let them know that the other app is trying to get their info, and ask whether they want to grant that permission. Oauth defines a way to initiate that permission verification from the other app’s site so that the user experience is smooth. If the user grants permission, I issue an AuthToken to the other app which it can use to make requests for that user's info.

Note on encryption

Oauth2 has nothing to do with encryption -- it relies upon SSL to keep things (like the client app’s shared_secret) secure.