Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / netIP.go
Last active August 29, 2015 14:06
net.IP Marshalling in JSON and YAML
package main
import (
"encoding/json"
"fmt"
"net"
"github.com/GoogleCloudPlatform/kubernetes/Godeps/_workspace/src/gopkg.in/v1/yaml"
)
include $(GOROOT)/src/Make.$(GOARCH)
all : webirc
TARG=webirc
GOFILES=main.go
include $(GOROOT)/src/Make.cmd
POST /accounts/OAuthGetRequestToken HTTP/1.1
Host: www.google.com
User-Agent: Go http package
Connection: close
Transfer-Encoding: chunked
Authorization: OAuth oauth_callback="http%3A%2F%2Flocalhost%3A8080%2Fcallback%2Foauth", oauth_consumer_key="cetico.org", oauth_nonce="5577006791947779410", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1282521243", oauth_version="1.0", oauth_signature="pVrdPTu2u5nYy2x5UgJZCTeKF6w%3D"
Content-Type: application/x-www-form-urlencoded
0
@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 / 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:2073020
Created March 18, 2012 13:51
memcache read from file
package main
import (
"bufio"
"bytes"
"encoding/base64"
"flag"
"fmt"
"io"
"os"
@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 / 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