Skip to content

Instantly share code, notes, and snippets.

View risentveber's full-sized avatar
🤠
angry cowboy

Boris Strelnikov risentveber

🤠
angry cowboy
View GitHub Profile

Librato cheatsheet

Terms

Report period - how often metric is sent to librato server(defaults to 1 minute).

Chart resolution - time between two sequential points on a chart(depends on chart time range).

Counter

Reported as delta since last report.

@risentveber
risentveber / test.rb
Created June 3, 2021 17:32
ruby test
require 'benchmark'
puts "You can also put forked code in a block pid: #{Process.pid}"
n = 100000
t = Benchmark.realtime do
n.times do
Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%6N')
end
end
puts "main total: #{t}, avg: #{t/n*1000}ms"
version: '2'
tasks:
up:
desc: "Run docker compose and subscribe to logs"
deps: [down]
cmds:
- docker-compose up --build -d
- docker logs -f api
down:
@risentveber
risentveber / Makefile
Last active September 15, 2020 11:14
edit : main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
cc -o edit main.o kbd.o command.o display.o \
insert.o search.o files.o utils.o
main.o : main.c defs.h
cc -c main.c
kbd.o : kbd.c defs.h command.h
cc -c kbd.c
command.o : command.c defs.h command.h
package dynamicqueue
import (
"fmt"
"strconv"
"sync"
"testing"
"time"
)
package dynamicqueue
import (
"sync"
)
type DynamicQueue interface {
Add(item interface{})
Stop()
}
func NewDynamicallyBufferedChannel(in <- chan interface{}) <- chan interface{} {
out := make(chan interface{})
var storage []interface{}
go func() {
defer close(out)
for {
if len(storage) == 0 {
item, ok := <-in
if !ok {
return
#!/bin/sh
cp ./tools/prepare-commit-msg.sh .git/hooks/prepare-commit-msg
cp ./tools/pre-commit.sh .git/hooks/pre-commit
cp ./tools/pre-push.sh .git/hooks/pre-push
chmod 755 .git/hooks/prepare-commit-msg
chmod 755 .git/hooks/pre-commit
chmod 755 .git/hooks/pre-push
#!/bin/sh
golangci-lint run --tests=0 ./...
#!/bin/sh
go test ./...