Skip to content

Instantly share code, notes, and snippets.

@nictuku
nictuku / edd.go
Created August 31, 2014 08:54
elite dangerous distances
package main
import (
"fmt"
"strings"
)
var distances = `26 Draconis,-39.000000,24.906250,-0.656250
Acihaut,-18.500000,25.281250,-4.000000
Aganippe,-11.562500,43.812500,11.625000
@nictuku
nictuku / custom.binds
Last active August 29, 2015 14:05
My PS3 button mapping for Elite: Dangerous
<?xml version="1.0" encoding="UTF-8" ?>
<Root>
<MouseXMode Value="" />
<MouseYMode Value="" />
<MouseDecay Value="1" />
<MouseHeadlook Value="0" />
<MouseSensitivity Value="0.89999998" />
<MouseDeadzone Value="0.04742857" />
<MouseLinearity Value="1.00000000" />
<YawAxis>
@nictuku
nictuku / randmatmul.go
Last active January 4, 2016 13:59
Improving the Julia microbench for Go
package main
import (
"fmt"
"math/rand"
"time"
"github.com/gonum/matrix/mat64"
// Switch to cblas for the C implementation of BLAS.
blas "github.com/gonum/blas/goblas"
)
@nictuku
nictuku / gist:4052652
Created November 10, 2012 21:51
supernode (incomplete)
// this is not complete and doesn't compile, but hopefully it's a useful guideline.
randInfoHash := false
if infoHash != "" {
if infoHash == "rand" {
randInfoHash = true
// No need to insist in getting peers for a specific infohash,
// since we're probing the address space.
numTargetPeers = 1
@nictuku
nictuku / ping.go
Created July 30, 2012 23:40
pingmeplz
package main
import (
"fmt"
logpkg "log"
"log/syslog"
"net"
"net/http"
"os"
"os/exec"
@nictuku
nictuku / sshd.go
Created April 8, 2012 15:43
Go SSH server complete example
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
@nictuku
nictuku / gist:2073020
Created March 18, 2012 13:51
memcache read from file
package main
import (
"bufio"
"bytes"
"encoding/base64"
"flag"
"fmt"
"io"
"os"
@nictuku
nictuku / hello.go
Created February 25, 2012 19:38
Testing cocode
// You can edit this code!
// Click here and start typing.
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
@nictuku
nictuku / gist:1341049
Created November 5, 2011 03:17
go snippet: Using the rand package to randomize access to a slice.
package main
import (
"fmt"
"rand"
"time"
)
func main() {
a := []int64{0, 1, 2, 3, 4, 5, 6}
@nictuku
nictuku / gist:997386
Created May 29, 2011 01:47
golang union types.
// Objective: demonstrate that there are more use cases
// for union types than previously thought.
// http://groups.google.com/group/golang-nuts/browse_thread/thread/fbde059a7cfd2fa9
//
// Interface inference.
// We already have type inference, so this would be very Go-like:
type typeA int
func (x typeA) A() {}
func (x typeB) C() {}