Skip to content

Instantly share code, notes, and snippets.

View ckelner's full-sized avatar
🐕‍🦺
Datadog

Chris Kelner ckelner

🐕‍🦺
Datadog
View GitHub Profile
@burnsie7
burnsie7 / log_redaction_examples.md
Created March 11, 2020 15:58
PII Log Redaction

Log Processing Rules

log_processing_rules:

Generic String: "sensitive-info"

  - type: exclude_at_match
    name: exclude_sensitive_info
    pattern: (?:sensitive\-info)
@rokibhasansagar
rokibhasansagar / gitclean.sh
Last active September 6, 2023 18:02 — forked from Zibri/gitclean.sh
Bash script to remove all revisions from github or gist repository.
#!/bin/bash
#
# By Zibri (2019)
# Modified by @rokibhasansagar
#
# Usage: gitclean git-repo-url
#
gitclean ()
{
git clone "$1" workDir && {
@burnsie7
burnsie7 / multi_org_hosts_count.py
Created July 29, 2018 21:35
multi_org_hosts_count.py
import datetime
import time
import requests
import simplejson
from datadog import initialize, api
"""
This script gives a real time report on ec2 and Datadog agent host usage
from multiple organizations and reports them up to the 'main' parent account.
@zparnold
zparnold / one_liner.sh
Last active April 25, 2024 21:56
A simply script to delete all failed pods from Kubernetes
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod

Understanding Kubernetes in 10 minutes

This document provides a rapid-fire overview of Kubernetes concepts, vocabulary, and operations. The target audience is anyone who runs applications in a cloud environment today, and who wants to understand the basic mechanics of a Kubernetes cluster. The goal is that within 10 minutes, managers who read this should be able to listen in on a Kubernetes conversation and follow along at a high level, and engineers should be ready to deploy a sample app to a toy cluster of their own.

This orientation doc was written because the official Kubernetes docs are a great reference, but they present a small cliff to climb for newcomers.

If you want to understand why you should consider running Kubernetes, see the official Kubernetes conceptual overview document. This document is intended to complement that one, but one layer deeper.

For a deep dive, see [Kubernetes concepts](https://kubernetes.io/docs/co

@mwlang
mwlang / application_controller.rb
Last active April 2, 2024 23:50
Logging headers, params, and body to console -- useful for debugging what a mobile app is sending Rails API backend server.
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
around_action :global_request_logging
def global_request_logging
http_request_header_keys = request.headers.env.keys.select{|header_name| header_name.match("^HTTP.*|^X-User.*")}
http_request_headers = request.headers.env.select{|header_name, header_value| http_request_header_keys.index(header_name)}
puts '*' * 40
pp request.method
@juanca
juanca / github_load_all_diffs.js
Created March 2, 2017 18:42
Github PR bookmarklet: Load all file diffs
javascript:
document.querySelectorAll('.load-diff-button').forEach(node => node.click())
@olivielpeau
olivielpeau / README.md
Last active February 7, 2018 21:00
Run JMXFetch as a different user (to use AttachAPI for instance)

These instructions are known to work with version 5.10.1 of the packaged linux Datadog Agent

Using the AttachAPI can require running JMXFetch as the same user as the JVM you want to monitor.

To run JMXFetch as the jmv_user user (once you've identified which user your JVM is running as), please follow these steps:

  1. Make 2 changes on the /etc/dd-agent/supervisor.conf file: supervisord should be configured to run with user=root and jmxfetch with user=jvm_user. See lines 20 and 58 of the attached file below.
  2. Add jvm_user to the dd-agent group (on Debian distros: sudo usermod -G dd-agent jvm_user, on RHEL: sudo gpasswd -a jvm_user dd-agent)
  3. Grant the dd-agent group write access to the JMXFetch log file and the agent's run directory (/opt/datadog-agent/run/): sudo chmod -R g+w /var/log/datadog/jmxfetch.log /opt/datadog-agent/run/
@michaelkeevildown
michaelkeevildown / credit-card-regex.md
Last active April 17, 2024 20:36
Credit Card Regex Patterns

Credit Card Regex

  • Amex Card: ^3[47][0-9]{13}$
  • BCGlobal: ^(6541|6556)[0-9]{12}$
  • Carte Blanche Card: ^389[0-9]{11}$
  • Diners Club Card: ^3(?:0[0-5]|[68][0-9])[0-9]{11}$
  • Discover Card: ^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$
  • Insta Payment Card: ^63[7-9][0-9]{13}$
  • JCB Card: ^(?:2131|1800|35\d{3})\d{11}$
  • KoreanLocalCard: ^9[0-9]{15}$
@Gary-Armstrong
Gary-Armstrong / Cannot Destroy
Last active January 6, 2016 16:35
Terraform Adventure in which Commenting or Removing the Instance Resource does not Cause a Destroy
garmstrong-ml:config-qa-aws-us-east-1 gary.armstrong$ grep aws_instance terraform.tfstate
"aws_instance.bastion": {
"type": "aws_instance",
garmstrong-ml:config-qa-aws-us-east-1 gary.armstrong$ terraform destroy -target=aws_instance.bastion
Do you really want to destroy?
Terraform will delete all your managed infrastructure.
There is no undo. Only 'yes' will be accepted to confirm.
Enter a value: yes