Skip to content

Instantly share code, notes, and snippets.

View gregbuehler's full-sized avatar

Greg Buehler gregbuehler

View GitHub Profile
@gregbuehler
gregbuehler / spl-allowlist.py
Created April 28, 2022 16:52
modify splunkcloud allowlists
#!/usr/bin/env python3
import sys, os
import json
import requests
from argparse import ArgumentParser
from enum import Enum
def allowlist_append(domain, token, addr):
endpoint = f"https://admin.splunk.com/{domain}/adminconfig/v2/access/s2s/ipallowlists"
@gregbuehler
gregbuehler / nrqlizer.py
Created November 16, 2019 01:29
Slack New Relic NRQL Slash Command Endpoint
#!/usr/bin/env python
import os
import requests
import json
from datetime import datetime
from flask import Flask, jsonify, request
app = Flask(__name__)
@gregbuehler
gregbuehler / nri-splunk.py
Created June 21, 2019 17:38
WIP NRI Splunk OHI
#!/usr/bin/env python
import requests
import argparse
import json
def remove_unwanted_data(data):
if 'eai:acl' in data: del data['eai:acl']
if 'pass4SymmKey' in data: del data['pass4SymmKey']
@gregbuehler
gregbuehler / docker-compose.yml
Created March 2, 2019 00:00
Observability Compose
---
version: "3"
services:
# utility
ouroboros:
image: pyouroboros/ouroboros
container_name: ouroboros
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
@gregbuehler
gregbuehler / tool_d42_randomize_job_schedules.py
Created August 20, 2018 17:43
Attempt to randomize d42 discovery schedules
#!/usr/bin/env python
import sys, os, getpass
import requests, json
import random
# suppress the warning about unverified https
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
@gregbuehler
gregbuehler / test.py
Created November 23, 2016 20:05
test, just prints a string and environment vars
import os
print('test')
print(os.environ)
@gregbuehler
gregbuehler / prune_artifactory.py
Last active November 23, 2016 20:38
prunes malformed artifactory hierarchy to maximum revisions
print("Loading Script")
import os
import re
import json
import requests
# config
host = os.environ['ARTIFACTORY_URL']
username = os.environ['ARTIFACTORY_USER']
@gregbuehler
gregbuehler / bar.go
Created July 13, 2016 20:09
Golang struct nastiness
columns => Id,Description,BarId,BarName
type Bar struct {
id int `db:BarId`
name sql.NullString `db:BarName`
}
type Foo struct {
id int `db:Id`
description sql.NullString `db:Description`
@gregbuehler
gregbuehler / github.rb
Created August 20, 2015 20:19
Github contributor stats to influxdb
require 'octokit'
require 'influxdb'
require 'yaml'
influxdb_config_file = File.dirname(File.expand_path(__FILE__)) + '/../config/influxdb.yml'
influxdb_config = YAML::load(File.open(influxdb_config_file))
influxdb = InfluxDB::Client.new influxdb_config['database'],
username: influxdb_config['username'],
password: influxdb_config['password'],