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
| require 'openssl' | |
| require 'base64' | |
| root_key = OpenSSL::PKey::RSA.new 2048 # the CA's public/private key | |
| root_ca = OpenSSL::X509::Certificate.new | |
| root_ca.version = 2 # cf. RFC 5280 - to make it a "v3" certificate | |
| root_ca.serial = 1 | |
| root_ca.subject = OpenSSL::X509::Name.parse "/DC=org/DC=ruby-lang/CN=Ruby CA" | |
| root_ca.issuer = root_ca.subject # root CA's are "self-signed" | |
| root_ca.public_key = root_key.public_key |
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() { | |
| t := time.Now() | |
| loc, err := time.LoadLocation("Asia/Jerusalem") |
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
| Raw configuration: | |
| [section] ; comment type of ; ? | |
| item = 1 ; comment 2 | |
| arr = 1, 4, 5 | |
| str = "hey" | |
| str2 = 'hey' | |
| float = 1.10 | |
| [[second section]] # comment type of # ? |
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" | |
| ) | |
| func UJoin(list []uint64, sep string) string { | |
| length := len(list) |
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" |
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 | |
| 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 | |
| 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
| # 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 ( | |
| "database/sql" | |
| "fmt" | |
| "time" | |
| "github.com/lib/pq" | |
| ) |