Skip to content

Instantly share code, notes, and snippets.

View skidder's full-sized avatar
:shipit:
Always shipping code

Scott Kidder skidder

:shipit:
Always shipping code
  • San Francisco, California, United States
View GitHub Profile
this.renditionSettingLRUCacheHitCounter = getRuntimeContext()
.getMetricGroup()
.addGroup("log_enrichment.cache")
.counter("hit");
this.renditionSettingLRUCacheMissCounter = getRuntimeContext()
.getMetricGroup()
.addGroup("log_enrichment.cache")
.counter("miss");
curl --request PUT \
--url http://localhost:8083/connectors/demo-kinesis-connector/config \
--header 'Content-Type: application/json' \
--data '{
"name": "demo-kinesis-connector",
"connector.class": "com.amazon.kinesis.kafka.AmazonKinesisSinkConnector",
"tasks.max": "6",
"errors.retry.timeout": "300000",
"topics": "demo-event-stream-export",
"roleSessionName": "demo-kafka-connect-connector",
@skidder
skidder / gcp-connector.sh
Last active December 4, 2020 03:47
Create a Kafka Connect connector that writes to a GCP PubSub topic
curl --request PUT \
--url http://localhost:8083/connectors/demo-gcp-connector/config \
--header 'Content-Type: application/json' \
--data '{
"connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector",
"tasks.max": "6",
"errors.retry.timeout": "300000",
"topics": "demo-event-stream-export",
"name": "demo-gcp-connector",
"cps.project": "external-mux",
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: kafka-connect
name: kafka-connect
namespace: replace-with-your-namespace
spec:
progressDeadlineSeconds: 600
selector:
FROM confluentinc/cp-kafka-connect:5.2.3
# Add Google Cloud PubSub connector
# See https://github.com/GoogleCloudPlatform/pubsub/tree/master/kafka-connector
COPY cps-kafka-connector.jar /usr/share/java/kafka/cps-kafka-connector.jar
# Add AWS Kinesis sink connector
# See https://github.com/awslabs/kinesis-kafka-connector
COPY amazon-kinesis-kafka-connector-0.0.9-SNAPSHOT.jar /usr/share/java/kafka/amazon-kinesis-kafka-connector-0.0.9-SNAPSHOT.jar
@skidder
skidder / rangerover.go
Created May 31, 2019 03:41
HTTP Range Request Utility
package main
import (
"bytes"
"crypto/md5"
"encoding/hex"
"flag"
"fmt"
"io"
"io/ioutil"
groups:
- name: ./certificate-expiry-monitor.rules
rules:
- alert: ExpiredTLSCertificatesCritical
expr: sum(certificate_expiry_monitor_certificate{status="expired"}) by (domain, ns) > 0
for: 1m
labels:
severity: critical
annotations:
description: There is an expired TLS certificate for the frontend domain {{ $labels.domain}} in namespace {{ $labels.ns }}. The ingress pods might not have renewed the certificate. You might need to delete them. Check the Grafana dashboard for TLS certificate expiry.
@skidder
skidder / jwt_signer.rb
Last active May 24, 2018 17:42
JWT Signing in Ruby
require 'base64'
require 'jwt'
def sign_url(playback_id, audience, expires, signing_key_id, private_key, params = {})
rsa_private = OpenSSL::PKey::RSA.new(Base64.decode64(private_key))
payload = {sub: playback_id, exp: expires.to_i, kid: signing_key_id, aud: audience}
payload.merge!(params)
JWT.encode(payload, rsa_private, 'RS256')
end