Skip to content

Instantly share code, notes, and snippets.

apokalyptik

Block or report user

Report or block apokalyptik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@apokalyptik
apokalyptik / encrypt.go
Created Sep 1, 2014
Go RSA public key encryption example. Compatible with http://us3.php.net/manual/en/function.openssl-private-decrypt.php for decryption
View encrypt.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
@apokalyptik
apokalyptik / decrypt.go
Created Sep 1, 2014
Go RSA private key decryption example. Compatible with data encrypted via http://us3.php.net/openssl_public_encrypt
View decrypt.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"flag"
"fmt"
"io/ioutil"
View string-slice-flag.go
type Foo struct {
value []string
}
func (f *Foo) String() string {
return ""
}
func (f *Foo) Set(s string) error {
f.value = append(f.value, s)
View keybase.md

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 Jun 18, 2014
Simple chat server in go
View sockchat.go
package main
import (
"log"
"net/http"
"code.google.com/p/go.net/websocket"
)
type register struct {
@apokalyptik
apokalyptik / test.go
Created Jun 18, 2014
Patricia VS Quicktrie
View test.go
package main
import (
"crypto/rand"
"log"
"net/http"
_ "net/http/pprof"
"github.com/apokalyptik/quicktrie"
"gopkg.in/tchap/go-patricia.v1/patricia"
View req-to-local.sh
#!/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
View uni.py
#!/usr/bin/python
import re
import unicodedata
import codecs
import urllib2
if 2 == len( u'\U0001f4a9' ):
length_ucs2 = len
else:
View uni.py
#!/usr/bin/python
import re
import unicodedata
lm = re.compile("^[0-9a-fA-F]")
s = u""
# http://www.unicode.org/Public/5.2.0/ucd/NamesList.txt
@apokalyptik
apokalyptik / gist:5952215
Created Jul 8, 2013
Super simple and informative exmple of using CGO
View gist:5952215
package main
// #include <ctype.h>
import "C"
import "log"
func main() {
for i := 32; i<126; i=i+1 {
log.Printf( "'%s' (%3d) isalpha: \t%d", string(byte(i)), i, C.isalpha(C.int(i)) )
}
You can’t perform that action at this time.