Skip to content

Instantly share code, notes, and snippets.

View xlab's full-sized avatar
:octocat:
Hacking

Max Kupriianov xlab

:octocat:
Hacking
View GitHub Profile
@xlab
xlab / tls_cert_management.go
Created January 10, 2017 13:00
A TLS Cert management example for Go server. For different domains.
package main
import (
"crypto/tls"
"flag"
"log"
"net/http"
"os"
"path/filepath"
"strings"
@xlab
xlab / main.go
Created December 25, 2016 18:00 — forked from phrozen/main.go
STL reader
package main
import (
"bufio"
"bytes"
"encoding/binary"
"flag"
"fmt"
"github.com/spf13/nitro"
"io"
@xlab
xlab / pump.go
Created November 10, 2016 22:06
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
type stopPumping struct{}
// pump returns a channel src such that sending on src will eventually send on
// dst, in order, but that src will always be ready to send/receive soon, even
// if dst currently isn't. It is effectively an infinitely buffered channel.
//
@xlab
xlab / VkComputeSample
Created November 8, 2016 02:59 — forked from sheredom/VkComputeSample
A simple Vulkan compute sample
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
//
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
@xlab
xlab / midiKeyboard64keys.c
Created September 20, 2016 18:44 — forked from codetinkerhack/midiKeyboard64keys.c
midiKeyboard64keys.c
// Pin Definitions
// Rows are connected to
const int row1 = 5;
const int row2 = 6;
const int row3 = 7;
const int row4 = 8;
const int row5 = 4;
const int row6 = 3;
const int row7 = 2;
const int row8 = 1;
@xlab
xlab / midiKeyboard_VelocityAftertouch.c
Created September 20, 2016 18:44 — forked from codetinkerhack/midiKeyboard_VelocityAftertouch.c
Arduino based Velocity sensitive Midi keyboard with Aftertouch
// Pin Definitions
// Rows are connected to Digital
const int rowPin[] = { 6, 7, 8, 5 };
// FSRs connected to Analog
const int fsrPin[] = { 2, 3, 4, 5 };
// The 74HC595 uses a serial communication
// link which has three pins
const int clock = 12;
func stealDefinesFromCC() (defs string, ok bool) {
cc, ok := os.LookupEnv("CC")
if !ok { // second chance for CPP
cc, ok = os.LookupEnv("CPP")
if !ok {
return
}
}
cmd := exec.Command(cc, "-dM", "-E", "-x", "c", "/dev/null")
buf, err := cmd.CombinedOutput()
@xlab
xlab / boltdb_put_perf.md
Last active March 3, 2016 22:38
BoltDB Put Performance Results (random keys)

Batch size = 400

Keys are random.

See the results below.

@xlab
xlab / lmdb_put_perf.md
Last active March 3, 2016 22:41
LMDB Put Performance Results (random keys)

Batch size = 400

Keys are random.

The results are below.

@xlab
xlab / lmdb_put_perf.md
Last active March 3, 2016 21:59
LMDB Put Performance Results

Batch size = 400

Keys are sorted.

The results are below.