Skip to content

Instantly share code, notes, and snippets.

@rikonor
rikonor / index.js
Created January 23, 2019 04:10
Script to convert time objects in RethinkDB dumps
const fs = require("fs");
//
// Utilities
//
const isArray = a => {
return !!a && a.constructor === Array;
};
@rikonor
rikonor / main.go
Created January 19, 2019 02:43
Server Sent Events (SSE) Example in Go
package main
import (
"fmt"
"log"
"net/http"
"sync"
"time"
)
@rikonor
rikonor / main.go
Created January 2, 2019 20:31
control shell from go
package main
import (
"io"
"log"
"os"
"os/exec"
"time"
)
@rikonor
rikonor / main.go
Created December 28, 2018 21:50
loki simple usage
package main
import (
"net/url"
"os"
"time"
"log"
"github.com/cortexproject/cortex/pkg/util/flagext"
@rikonor
rikonor / main.go
Last active December 19, 2018 02:08
opencensus-verbose
package main
import (
"context"
"fmt"
"log"
"time"
"go.opencensus.io/stats"
"go.opencensus.io/stats/view"
@rikonor
rikonor / wait_cloud_init.sh
Created November 16, 2018 18:02
Wait for cloud-init to finish
#!/usr/bin/env bash
set -euo pipefail
CLOUD_INIT_FINISH_FILE="/var/lib/cloud/instance/boot-finished"
FILE_NAME=${FILE_NAME:-$CLOUD_INIT_FINISH_FILE}
SLEEP_DELAY=${SLEEP_DELAY:-1}
TIMEOUT_SECONDS=${TIMEOUT_SECONDS:-30}
@rikonor
rikonor / 1-with-direct-artifact.txt
Created November 9, 2018 14:43
Installing from artifacts-repo vs pypiserver
# Set up dir of packages
mkdir packages && cd packages
pip download docker
# Create a tar with all the packages
tar -czf python-packages.tar.gz *
# Upload to artifacts repository
./upload python-packages.tar.gz
@rikonor
rikonor / main.go
Created October 26, 2018 18:26
OpenCensus example
package main
import (
"context"
"fmt"
"log"
"net/http"
"tb/errgroup"
"time"
@rikonor
rikonor / main_test.go
Created October 14, 2018 23:28
Benchmark comparing context storage vs direct argument passing
package main
import (
"context"
"errors"
"testing"
)
func BenchmarkParamViaContext(b *testing.B) {
p := &Person{
SYSTEM_MODE(SEMI_AUTOMATIC);
#include "scheduler.h";
#include "lgger.h";
#include "tmp36.h";
#include "udp_client.h";
#include "aggregator.h";
// Duration
typedef unsigned int Duration;