This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"math" | |
"testing" | |
) | |
const bits32 = 24 | |
const step32 float32 = 1 / (1 << bits32) | |
const mask32 uint32 = (1 << bits32) - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/binary" | |
"flag" | |
"fmt" | |
"io" | |
"os" | |
"runtime" | |
"sort" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"database/sql" | |
"fmt" | |
"reflect" | |
) | |
type Field interface { | |
Name() string | |
Ptr() interface{} | |
Tags() string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
"math/big" | |
"os" | |
) | |
func generateIntBounds(w io.Writer) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see http://godoc.org/github.com/arnehormann/goof/envflag | |
package main | |
import ( | |
"fmt" | |
"io" | |
"os" | |
"sort" | |
"strings" | |
"text/tabwriter" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
### build nginx/openresty as a static binary with most recent libraries. | |
### apart from build tools, this script depends on sha256sum, tar, curl. | |
# features | |
ENABLE_MAIL="${ENABLE_EMAIL:-true}" | |
ENABLE_MEDIA="${ENABLE_MEDIA:-true}" | |
ENABLE_WEBDAV="${ENABLE_WEBDAV:-true}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"errors" | |
"fmt" | |
"os" | |
"time" | |
pipe "gopkg.in/pipe.v2" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e -u -o pipefail # -x | |
echo $'Project\tCommit\tBranch\tFiletype\tLines' | |
for dir in *.git; do | |
export GIT_DIR="$dir" | |
export PREFIX=$(git for-each-ref --count=1 --sort=committerdate --format=$'%(objectname)\t%(refname)') | |
export BRANCH=$(echo -e "${PREFIX}" | cut -d $'\t' -f 1) | |
##### from these filetypes ##### | |
for filetype in java cs rb go py as php html htm css js json xml conf cnf; do | |
echo -n -e "${dir}\t${PREFIX}\t${filetype}\t" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e -u -o pipefail | |
PWD=`pwd` | |
WHOAMI=`whoami` | |
BASEDIR=${MYSQL_SERVER_BASEDIR?missing MYSQL_SERVER_BASEDIR} | |
# default directories are subdirectories of where this script was run from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Path(v interface{}, ks ...interface{}) (reflect.Value, error) { | |
val := reflect.ValueOf(v) | |
for i, k := range ks { | |
switch key := k.(type) { | |
case string: // struct field | |
if val.Kind() != reflect.Struct { | |
return reflect.ValueOf(nil), fmt.Errorf("Error at %v[%d]: must be struct", ks, i) | |
} | |
val = val.FieldByName(key) | |
case reflect.Kind: // type |
NewerOlder