CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' *.go
- structs
- Various utilities to work with Go (Golang) structs.
map[string]interface{}
struct conversion.
github.com/fatih/structs
#!/bin/bash | |
./process_1.sh & | |
pid_1=`echo $!` | |
./process_2.sh & | |
pid_2=`echo $!` | |
./process_3.sh & | |
pid_3=`echo $!` |
module Abstract | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
def hello | |
'hello from instance method' | |
end | |
module ClassMethods |
String.class_eval do | |
alias_method :original_initialize, :initialize | |
def initialize(*args) | |
# https://www.ruby-forum.com/topic/1893190 | |
c = caller(0) | |
case | |
when c.to_s.include?('module:V1') | |
instance_eval do | |
def to_v1 |
module MethodInterception | |
def before_filter(*meths, &blk) | |
return @wrap_next_method = true if meths.empty? | |
meths.delete_if { |meth| wrap(meth, &blk) if method_defined?(meth) } | |
@intercepted_methods += meths | |
end | |
private | |
def wrap(meth, &blk) |
package profiler | |
import ( | |
"github.com/wblakecaldwell/profiler" | |
"net/http" | |
"sync" | |
) | |
var cache = struct { | |
sync.RWMutex |
package main | |
import ( | |
"bytes" | |
"encoding/gob" | |
"fmt" | |
"github.com/peterbourgon/diskv" | |
) |
package main | |
import ( | |
"fmt" | |
"sync" | |
"time" | |
) | |
// limiter is a counting semaphore for limiting concurrency in action function. | |
var limiter = make(chan struct{}, 4) |
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' *.go
map[string]interface{}
struct conversion.github.com/fatih/structs
package main | |
import ( | |
"bytes" | |
"compress/gzip" | |
"errors" | |
"fmt" | |
"io" | |
) |
package main | |
import ( | |
"fmt" | |
"unicode" | |
) | |
func main() { | |
for _, v := range []string{"target_prob1", "target_prob_1", "_target_prob_1", "target_prob_1_"} { | |
fmt.Printf("%s => %s\n", v, ToCamel(v)) |