Skip to content

Instantly share code, notes, and snippets.

View graphaelli's full-sized avatar

Gil Raphaelli graphaelli

View GitHub Profile
module otel-ping
go 1.18
require (
github.com/census-instrumentation/opencensus-proto v0.3.0
github.com/gogo/protobuf v1.3.2
go.opentelemetry.io/collector/pdata v0.57.2
go.opentelemetry.io/otel v1.9.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.31.0
@graphaelli
graphaelli / batch-update.sql
Created April 19, 2017 22:44
batch postgresql updates with a CTE
-- based on https://news.ycombinator.com/item?id=9018756
=# select *, 'foo'::text into test from generate_series(1,5) as id;
SELECT 5
Time: 77.975 ms
=# select * from test;
┌────┬──────┐
│ id │ text │
├────┼──────┤
│ 1 │ foo │
│ 2 │ foo │
@graphaelli
graphaelli / elastic-jaeger-otlp-demo.md
Last active February 22, 2023 01:31
Jaeger OTLP export to Elastic Cloud (ESS)

Grab a recent CA cert bundle, to verify SSL connections

curl -LO https://raw.githubusercontent.com/stripe/stripe-ruby/master/lib/data/ca-certificates.crt

Start HotRod with OTLP export

ELASTIC_APM_SERVER_URL and ELASTIC_APM_SECRET_TOKEN can be found through kibana, at ${kibana_url}/app/home#/tutorial/apm (or click on "add data" in the APM UI)

@graphaelli
graphaelli / zube.go
Created December 5, 2019 15:49
Zube API Client
package main
import (
"crypto/rsa"
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
package main
import (
"bytes"
"context"
"encoding/json"
"errors"
"flag"
"fmt"
"io"
package main
import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
"os"
)
package main
import (
"context"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
@graphaelli
graphaelli / Vagrantfile
Created September 22, 2021 02:21
nomad on Ubuntu 21.10
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.boot_timeout = 600
config.vm.box = "ubuntu/impish64"
config.vm.network "public_network", bridge: "en0: Wi-Fi (Wireless)", use_dhcp_assigned_default_route: true
config.vm.network "forwarded_port", guest: 4646, host: 4646, auto_correct: true, host_ip: "127.0.0.1"
config.vm.synced_folder ".", "/vagrant", disabled: false
# vagrant plugin install vagrant-disksize
@graphaelli
graphaelli / test_pg_conn_mock.py
Created December 9, 2016 03:55
test pg connection mock
#!/usr/bin/env python
from __future__ import print_function
try:
import mock
except ImportError:
from unittest import mock
import unittest
#!/usr/bin/env python
import hashlib
import binascii
import os
from evernote.api.client import EvernoteClient
from evernote.edam.notestore.ttypes import NoteFilter, NotesMetadataResultSpec
auth_token = ""