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 ( | |
"crypto/rand" | |
"fmt" | |
"golang.org/x/crypto/scrypt" | |
) | |
func main() { |
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 "C" | |
import ( | |
"fmt" | |
"plugin" | |
) | |
func main() { | |
p, err := plugin.Open("./plugins.so") |
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" | |
"net/url" | |
"github.com/streadway/amqp" | |
) | |
// InitByConfigServices loads configuration from a conf file |
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" | |
"strconv" | |
"strings" | |
) | |
func toUin64(data, sep string) []uint64 { | |
fields := strings.Split(data, sep) |
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 ( | |
"database/sql" | |
"fmt" | |
"time" | |
"github.com/lib/pq" | |
) |
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
# based on https://gist.github.com/sinisterchipmunk/1335041 | |
require 'rubygems/package' | |
require 'fileutils' | |
require 'zlib' | |
def create_tar(path, opts={}) | |
tarfile = StringIO.new("") | |
Gem::Package::TarWriter.new(tarfile) do |tar| | |
Dir[File.join(path, "**/*")].each do |file| | |
mode = File.stat(file).mode |
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" | |
"time" | |
) | |
func main() { | |
fmt.Println("Times: ") | |
t := time.Now() |
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" | |
func sliceIndex(limit int, predicate func(i int) bool) int { | |
for i := 0; i < limit; i++ { | |
if predicate(i) { | |
return i | |
} | |
} |
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 | |
// #cgo LDFLAGS: -L /path/to/lib/ -lgolibrary | |
// | |
// #include <golibrary_header.h> | |
// | |
import "C" | |
func main() { | |
C.func2() |
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 | |
/* | |
go build -buildmode=c-shared -o libgolibrary.so libgolibrary.go | |
go tool cgo | |
*/ | |
import "C" | |
import "fmt" |