Skip to content

Instantly share code, notes, and snippets.

View coxley's full-sized avatar
:shipit:

Codey Oxley coxley

:shipit:
View GitHub Profile
@tr-fteixeira
tr-fteixeira / slack-pagerduty-oncall.py
Created March 8, 2021 17:24
Updates a Slack User Group with People that are on call in PagerDuty (updated for slack_sdk after previous auth method was deprecated, changed user lookup on slack). Based on: https://gist.github.com/markddavidoff/863d77c351672345afa3fd465a970ad6
"""
Script to update on-call groups based on pagerduty escalation policies
From: https://gist.github.com/markddavidoff/863d77c351672345afa3fd465a970ad6
Slack permissions required:
- Installer must be able to update user groups.
- usergroups:read
- usergroups:write
- users:read
- users:read.email
import os
from datadog_api_client import Configuration, ApiClient
from datadog_api_client.exceptions import ApiAttributeError
from datadog_api_client.exceptions import ApiTypeError, ApiValueError
from datadog_api_client.v1.api.dashboards_api import DashboardsApi
from datadog_api_client.v1.api.monitors_api import MonitorsApi
from datadog_api_client.v1.model.formula_and_function_metric_data_source import FormulaAndFunctionMetricDataSource
from datadog_api_client.v2.api.metrics_api import MetricsApi
@coxley
coxley / postgres_test.go
Created July 18, 2024 15:17
Postgres test isolation helper
package pgtest
import (
"context"
"fmt"
"strings"
"sync"
"testing"
"github.com/docker/go-connections/nat"