Skip to content

Instantly share code, notes, and snippets.

View samuel's full-sized avatar

Samuel Stauffer samuel

View GitHub Profile
select pk.pkey, tm.schemaname||'.'||tm.tablename, 'create table '||tm.schemaname||'.'||tm.tablename
||' ('
||cp.coldef
-- primary key
||decode(pk.pkey,null,'',pk.pkey)
-- diststyle and dist key
||decode(d.distkey,null,') diststyle '||dist_style||' ',d.distkey)
--sort key
|| (select decode(skey,null,'',skey) from (select
' sortkey(' ||substr(array_to_string(
@samuel
samuel / otsu.go
Last active September 27, 2017 20:36
// Otsu is "A Threshold Selection Method from Gray-Level Histograms"
// <http://ieeexplore.ieee.org/ielx5/21/4310064/04310076.pdf?tp=&arnumber=4310076&isnumber=4310064>
func Otsu(hist []int, start, end int) int {
if end == 0 {
end = len(hist)
} else if end >= len(hist) {
end = len(hist) - 1
}
if start < 0 {
start = 0
This file has been truncated, but you can view the full file.
2016/08/19 15:27:39 [INFO] Terraform version: 0.7.1 55ba6ebd3d0e7800bc3755690ab60f6e4ca8bf94
2016/08/19 15:27:39 [INFO] CLI args: []string{"/Users/samuel/bin/terraform", "plan"}
2016/08/19 15:27:39 [DEBUG] Detected home directory from env var: /Users/samuel
2016/08/19 15:27:39 [DEBUG] Detected home directory from env var: /Users/samuel
2016/08/19 15:27:39 [DEBUG] Attempting to open CLI config file: /Users/samuel/.terraformrc
2016/08/19 15:27:39 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/08/19 15:27:39 [DEBUG] Detected home directory from env var: /Users/samuel
2016/08/19 15:27:39 [TRACE] Preserving existing state lineage "dbc2debd-7aa0-4b63-9324-c3f1c0de82c4"
2016/08/19 15:27:39 [TRACE] Preserving existing state lineage "dbc2debd-7aa0-4b63-9324-c3f1c0de82c4"
2016/08/19 15:27:39 [INFO] state modified during read or write. incrementing serial number
Go 1.6.2
```
"".VScaleF32 t=1 size=128 value=0 args=0x38 locals=0x0
0x0000 00000 (math32.go:7) TEXT "".VScaleF32(SB), $0-56
0x0000 00000 (math32.go:7) MOVQ (TLS), CX
0x0009 00009 (math32.go:7) CMPQ SP, 16(CX)
0x000d 00013 (math32.go:7) JLS 119
0x000f 00015 (math32.go:7) NOP
0x000f 00015 (math32.go:7) NOP
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
@samuel
samuel / miny.go
Last active November 12, 2015 20:25
Facebook's Miny Compression
package main
import (
"fmt"
"log"
"regexp"
"sort"
"strconv"
"strings"
)

Keybase proof

I hereby claim:

  • I am samuel on github.
  • I am samuelks (https://keybase.io/samuelks) on keybase.
  • I have a public key whose fingerprint is 67C7 B7C8 84C3 1BF4 5E79 B476 47CE 13DD 69F5 482D

To claim this, I am signing this object:

@samuel
samuel / thriftserde.go
Created May 27, 2014 18:25
Example of Thrift struct serialization / deserialization
package main
import (
"bytes"
"log"
"github.com/samuel/go-thrift/thrift"
)
type testStruct struct {
Plaintext name
012345678901234501234567890123450123456789012345
Encrypted name
ECRYPTFS_FNEK_ENCRYPTED.FZbHZH0OehHS.UYR-EMFXrPLWfnWSl6lm8eUG619AmlkPnMjVDCRSUlAivmdT.nPN8-WZ7AVxfk76gOweLkQqqGU6dGH6TOw0G94j8Zw5BhYc08IYm5qj-YWlU--
Decoded encrypted name
@samuel
samuel / ansi_colors.go
Created December 31, 2013 21:30
ANSI Colors
type Color string
const (
ColorNone Color = ""
ColorReset Color = "\033[0m"
ColorBold Color = "\033[1m"
ColorBlack Color = "\033[0;30m"
ColorRed Color = "\033[0;31m"
ColorGreen Color = "\033[0;32m"
ColorYellow Color = "\033[0;33m"