Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌

David Rio Deiros drio

🐌
View GitHub Profile
View PromQL-notes.md

Ch13 - Intro to PromQL

Aggregating gauges

We have a gauge metric called: node_filesystem_size_bytes

node_filesystem_free_bytes{device="/dev/sda1",fstype="vfat",
        instance="localhost:9100",job="node",mountpoint="/boot/efi"} 70300672
 node_filesystem_free_bytes{device="/dev/sda5",fstype="ext4",
View drio-metadata.xml
<?xml version="1.0"?>
<md:EntityDescriptor entityID="urn:amazon:cognito:sp:us-east-1_HChS0Nmga">
<md:SPSSODescriptor AuthnRequestsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
<md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="https://tufts-shib-staging.auth.us-east-1.amazoncognito.com/saml2/idpresponse" index="1"/>
<md:AttributeConsumingService index="1">
<md:ServiceName xml:lang="en">Cognito Test Shib</md:ServiceName>
<md:RequestedAttribute FriendlyName="givenName" Name="urn:oid:2.5.4.42"/>
<md:RequestedAttribute FriendlyName="sn" Name="urn:oid:2.5.4.4"/>
<md:RequestedAttribute FriendlyName="mail" Name="urn:oid:0.9.2342.19200300.100.1.3"/>
View metadata.staging.xml
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" validUntil="2022-03-31T17:10:39.744Z" entityID="https://staging.drtufts.net/saml/metadata">
<SPSSODescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" validUntil="2022-03-31T17:10:39.743793359Z" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol" AuthnRequestsSigned="false" WantAssertionsSigned="true">
<KeyDescriptor use="encryption">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Certificate xmlns="http://www.w3.org/2000/09/xmldsig#">MIICqjCCAZICCQC6eUzsDXLswzANBgkqhkiG9w0BAQsFADAXMRUwEwYDVQQDDAwuZXhhbXBsZS5jb20wHhcNMjIwMzA5MjEwMzA4WhcNMjMwMzA5MjEwMzA4WjAXMRUwEwYDVQQDDAwuZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCxSkMqXJKLrCp5Ywugxw2/oUcyGkqFNQqOn7Uf/TTCGYZMKjCnd88dXbPpMMDH8O17TJxS4pygCzXSUXZyWicDrnwOmteNvfYJGehFCbzL1fit7PmAbpdra6Q/baCfQm+R6Jpm9CVyIm6WkKeXUcYymb4RyCSIqHZ1vP0oUmQUL47bdBuoDxt/YULH6SQjxzgI4wEAETgM1c6oKFmZu5
View saml-flow-samltestid.txt
2022-03-17 11:16:27,681 - DEBUG [PROTOCOL_MESSAGE:?] -
<?xml version="1.0" encoding="UTF-8"?>
<samlp:LogoutRequest
Destination="https://samltest.id/idp/profile/SAML2/Redirect/SLO"
ID="id-b92224d213b3905baf9a184d92170c5d9f98ec56"
IssueInstant="2022-03-17T11:16:27.575Z" Version="2.0"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">https://staging.drtufts.net/saml/metadata</saml:Issuer>
<saml:NameID
Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
View saml-sp-server.go
// vim: set foldmethod=indent foldlevel=1 et:
package main
import (
"context"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
@drio
drio / fastq-nine-years-later.md
Last active Feb 19, 2022
Benchmark fastq reads
View fastq-nine-years-later.md

Nine years ago I was doing a lot of bioinformatics work. I was also writing golang code to learn the language and see if I could use it for my daily programming tasks.

At the same time I came across a set of benchmarks that tested how fast different programming languages could read fastq files. The winner was a heavily optimized c program.

Naturally, I decided to write an implementation in golang. My first attempt did not do better than the c version (didn't do that bad either -- same order of magnitude if I remember correctly). But with the help of the golang community I ended up writing a version that was faster than the c implementation.

Fast forward 9 years. I came across this article that discusses how the different versions of golang have been cons

View gist:9aed19c2c60c825064889abae70c19f4
from confluent_kafka import Producer
class SimpleProducer:
def __init__(self, brokers: str):
config = {'bootstrap.servers': brokers, 'queue.buffering.max.ms': 1,
'message.send.max.retries': 5, 'retry.backoff.ms': 200,
'message.max.bytes': 104857600,
'default.topic.config': {'request.required.acks': 'all'}}
View gist:afa0d4e13c872f28ec2a9f4d5ab6d97a
from confluent_kafka import Consumer, KafkaError, OFFSET_BEGINNING
class SimpleConsumer:
def __init__(self, brokers: str, topic: str, consumer_group: str):
self.topic = topic
self.config = {
'bootstrap.servers': brokers,
'group.id': consumer_group,
View gist:b5262a864df722ade9ba311fca0e9250
#!./.venv/bin/python3
from confluent_kafka import Consumer, KafkaException
import sys
import getopt
import json
import logging
from pprint import pformat
config = {
View Makefile
BASEDIR=$(shell basename $(PWD))
PRJ_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SSH_HOST=h4
GROUP=ss1
OFFSET=0
KB=
ifeq '$(shell hostname -s)' 'hadoop-prod-04'
KB=@docker run -it -v "/home/driode01/kafka-area/":/stuff/ --network=host confluentinc/cp-kafka