Skip to content

Instantly share code, notes, and snippets.

@cryptix
cryptix / runner.go
Created May 26, 2014 17:57
Copying binary ints to a c programm using golangs encoding/binary
package main
import (
"bufio"
"encoding/binary"
"fmt"
"io"
"os"
"os/exec"
"runtime"
@cryptix
cryptix / LICENSE
Last active March 10, 2024 09:55
example of using JWT for http authentication in go
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE S
@cryptix
cryptix / seekTest.go
Last active August 29, 2015 14:01
"not found" when using gridfile as io.WriteSeeker
package main
import (
"fmt"
"io"
"os"
"labix.org/v2/mgo"
)
@cryptix
cryptix / main.go
Last active August 29, 2015 14:00
Martini Route/Render TemplateFuncs issue
package main
import (
"github.com/go-martini/martini"
"github.com/martini-contrib/render"
"html/template"
)
var templateFuncs = template.FuncMap{
// define an empty stub first, otherwise html/template will complain with "missing function"
@cryptix
cryptix / 1.xyz
Created April 23, 2014 10:32
cznic/ql ql.chunk error
0.0000 169.4456 -248.4184
0.0000 169.4412 -248.4166
0.0000 169.4411 -248.4100
0.0000 169.4363 -248.4091
0.0000 169.4333 -248.4034
0.0000 169.4315 -248.4015
0.0000 169.4271 -248.3997
0.0000 169.4237 -248.3950
0.0000 169.4212 -248.3950
0.0000 169.4178 -248.3903
@cryptix
cryptix / keybase.md
Created April 12, 2014 14:08
Keybase proove

Keybase proof

I hereby claim:

  • I am cryptix on github.
  • I am cryptix (https://keybase.io/cryptix) on keybase.
  • I have a public key whose fingerprint is FD14 3DF5 8E62 AB23 421D EAE5 8D7D 5D44 0B9F 6E26

To claim this, I am signing this object:

@cryptix
cryptix / joinedScan.go
Created February 6, 2014 13:22
Scaning Complex SQL Query results into multiple objects (better relation loading)
package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"log"
)
const sqlConf = "root:root@tcp(localhost:3306)/testJoinScan"
@cryptix
cryptix / connectback.go
Created January 17, 2014 16:34
Connect-Back shell in <50 lines of Go
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os/exec"
)
@cryptix
cryptix / smtpAuthLogin.go
Created October 4, 2013 09:27
implements the smtp.Auth interface to use AUTH with the LOGIN scheme.
// mailing helpers
type loginAuth struct {
username, password string
}
func LoginAuth(username, password string) smtp.Auth {
return &loginAuth{username, password}
}
func (a *loginAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
@cryptix
cryptix / runner.go
Created August 8, 2013 12:25
PSHDL sim runner for lilHarv
package main
// simulateC.c comes from api.pshdl.org
// http://api.pshdl.org/api/v0.1/workspace/3978D82198FB1F6B
// in this case
// #include "simulateC.h"
import "C"
import (