Skip to content

Instantly share code, notes, and snippets.

View chicagobuss's full-sized avatar

Joshua Buss chicagobuss

View GitHub Profile
@chicagobuss
chicagobuss / match_jmx_metrics
Created February 26, 2019 02:28
matched jmx metrics
#####################################
Instance: 10.74.147.10:7203
#####################################
Matching: 1/350. Bean name: kafka.network:type=RequestMetrics,name=RequestsPerSec,request=OffsetCommit,version=6 - Attribute name: Count - Attribute type: long
Matching: 2/350. Bean name: kafka.network:type=RequestMetrics,name=ResponseSendTimeMs,request=FetchConsumer - Attribute name: 50thPercentile - Attribute type: double
Matching: 3/350. Bean name: kafka.network:type=RequestMetrics,name=ResponseSendTimeMs,request=FetchConsumer - Attribute name: Mean - Attribute type: double
Matching: 4/350. Bean name: kafka.network:type=RequestMetrics,name=ResponseSendTimeMs,request=FetchConsumer - Attribute name: 99thPercentile - Attribute type: double
Matching: 5/350. Bean name: kafka.network:type=RequestMetrics,name=ResponseSendTimeMs,request=FetchConsumer - Attribute name: 999thPercentile - Attribute type: double
@chicagobuss
chicagobuss / bash_to_gist.sh
Created February 28, 2019 14:06
make a gist from the shell
### how to upload to gist with bash / curl
DESC="file that I'm uploading"
FNAME="file_to_upload"
FPATH="/tmp/file_to_upload"
# 1. Somehow sanitize the file content
# Remove \r (from Windows end-of-lines),
# Replace tabs by \t
# Replace " by \"
@chicagobuss
chicagobuss / costs.txt
Created August 2, 2019 21:56
cost_structs
FIXED_HOURLY_COSTS = {
'DISKS': {
'aws': {
'us-east-1': {
'io1': 0.125 / 30 / 24,
'gp2': 0.1 / 30 / 24,
'st1': 0.045 / 30 / 24,
'sc1': 0.025 / 30 / 24
},
'us-east-2': {
@chicagobuss
chicagobuss / cc-viz.py
Last active November 6, 2019 23:20
for helping customers use our metrics firehose
#!/usr/bin/env python3
#
# cc-viz.py
#
# A hastily-thrown together collection of functions that gets confluent cloud metrics into datadog, graphite, or prometheus (or any combination of those)
#
GRAPHITE_HOST = '10.1.2.3'
GRAPHITE_PORT = 2003
GRAPHITE_METRIC_PREFIX = 'confluent.cloud.kafka'
@chicagobuss
chicagobuss / query.py
Last active July 25, 2023 17:49
boto3 dynamodb query with filter
#!/usr/bin/env python
import boto3
import json
from boto3.dynamodb.conditions import Key, Attr
from datetime import datetime
DIMENSION = 'logicalCpuCount'
TABLE_NAME = 'ms-usage-metering'
@chicagobuss
chicagobuss / .bashrc
Created February 3, 2025 16:39
ssh_agent_bashrc
# SSH Agent
if [[ ! $(ps -ef | grep "[s]sh-agent") ]]; then
echo "Starting SSH Agent"
eval $(ssh-agent -s)
else
ssh_agent_pid=$(pidof ssh-agent)
socket=$(find /tmp/ssh* | grep agent)
short_sock=$(find /tmp/ssh* | grep agent | cut -d '.' -f 2)
if [[ "${short_sock::-2}" == "${ssh_agent_pid::-2}" ]]; then
echo "Found ssh-agent running with pid ${ssh_agent_pid} and matching"