Skip to content

Instantly share code, notes, and snippets.

package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
package main
import (
"flag"
"fmt"
"log"
"net/http"
"sync"
"time"
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
var listenOn = "127.0.0.1:8888"
@apokalyptik
apokalyptik / encrypt.go
Created September 1, 2014 22:38
Go RSA public key encryption example. Compatible with http://us3.php.net/manual/en/function.openssl-private-decrypt.php for decryption
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
@apokalyptik
apokalyptik / decrypt.go
Created September 1, 2014 22:36
Go RSA private key decryption example. Compatible with data encrypted via http://us3.php.net/openssl_public_encrypt
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"flag"
"fmt"
"io/ioutil"
type Foo struct {
value []string
}
func (f *Foo) String() string {
return ""
}
func (f *Foo) Set(s string) error {
f.value = append(f.value, s)

Keybase proof

I hereby claim:

  • I am apokalyptik on github.
  • I am apokalyptik (https://keybase.io/apokalyptik) on keybase.
  • I have a public key whose fingerprint is 8832 E456 A26F 1E55 CBD7 32BD ED63 D6A0 9A85 639A

To claim this, I am signing this object:

@apokalyptik
apokalyptik / sockchat.go
Created June 18, 2014 19:11
Simple chat server in go
package main
import (
"log"
"net/http"
"code.google.com/p/go.net/websocket"
)
type register struct {
@apokalyptik
apokalyptik / test.go
Created June 18, 2014 18:36
Patricia VS Quicktrie
package main
import (
"crypto/rand"
"log"
"net/http"
_ "net/http/pprof"
"github.com/apokalyptik/quicktrie"
"gopkg.in/tchap/go-patricia.v1/patricia"
#!/bin/bash
#
# Please note: This script is likely very brittle...
#
ORIGIN=$1
OUT_DIR=$2
if [ "$2" == "" ] || [ "$1" == "" ]; then echo "Please specify origin requirements file and output directory"; exit 4; fi