Skip to content

Instantly share code, notes, and snippets.

@Deconstrained
Deconstrained / m3u_to_brasero.py
Created December 7, 2018 06:30
Python script to convert a M3U into the XML format that Brasero uses for its project files, so that one can burn a playlist to a data CD. YMMV.
#!/usr/bin/env python3
import argparse
import os
import sys
import urllib.parse as url
import xml.etree.ElementTree as ET
def main():
ap = argparse.ArgumentParser(description="Convert an M3U file to a Brasero "
@Deconstrained
Deconstrained / splunk_impact_metric.py
Last active October 18, 2018 16:16
Sample code for a Splunk plugin to submit PagerDuty impact metrics, but only when there's an open incident
#!/usr/bin/env python
"""
Sample code for a theoretical Splunk plugin to record an observed value as a
PagerDuty Impact Metric, and only during incidents triggered via Splunk
Requires pdpyras:
https://pagerduty.github.io/pdpyras/
"""
@Deconstrained
Deconstrained / pagerduty-agent
Last active November 1, 2018 15:38 — forked from jcurreee/pagerduty-agent
Add PagerDuty Agent notification method for Check_MK
#!/bin/bash
# PagerDuty Agent
COMMAND="/usr/bin/env - /usr/share/pdagent-integrations/bin/pd-nagios"
if [ "$NOTIFY_WHAT" = "SERVICE" ]; then
$COMMAND -n service -k $NOTIFY_PARAMETER_1 -t $NOTIFY_NOTIFICATIONTYPE -f SERVICEDESC="$NOTIFY_SERVICEDESC" -f SERVICESTATE="$NOTIFY_SERVICESTATE" -f HOSTNAME="$NOTIFY_HOSTNAME"
elif [ "$NOTIFY_WHAT" = "HOST" ]; then
$COMMAND -n host -k $NOTIFY_PARAMETER_1 -t $NOTIFY_NOTIFICATIONTYPE -f HOSTNAME="$NOTIFY_HOSTNAME" -f HOSTSTATE="$NOTIFY_HOSTSTATE"
fi
@Deconstrained
Deconstrained / update_ec2_pd_webhook_ip_security_group.py
Last active January 20, 2022 00:20
Updates an EC2 security group with rules to permit connections from PagerDuty IP addresses
#!/usr/bin/env python
import argparse
import logging
import os
import requests
import subprocess
import sys
from boto.ec2 import get_region

Keybase proof

I hereby claim:

  • I am Deconstrained on github.
  • I am demitrimorgan (https://keybase.io/demitrimorgan) on keybase.
  • I have a public key whose fingerprint is 97C5 BA40 5FD4 6152 BBD9 DDB5 1D47 ABDB B221 16AE

To claim this, I am signing this object:

@Deconstrained
Deconstrained / parse_clipper_statement.py
Last active January 5, 2018 03:18
Script to parse Clipper activity logs and calculate sums
#!/usr/bin/env python3
"""
@author Demitri Morgan <demitri.morgan@gmail.com>
Takes the ugly, poorly-formatted text output from Clipper's web portal...
https://www.clippercard.com/ClipperCard/dashboard.jsf
...and prints it to stdout in three columns: time, credit and debit.
@Deconstrained
Deconstrained / get_alerts_csv.py
Last active September 28, 2018 07:53
Generate a report of alerts for a given incident
#!/usr/bin/env python
#
# Copyright (c) 2017, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@Deconstrained
Deconstrained / get_incident_details_csv.py
Last active September 7, 2017 23:31 — forked from lfepp/get_incident_details_csv.py
Output PagerDuty incident details to a CSV
#!/usr/bin/env python
#
# Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@Deconstrained
Deconstrained / TestPDConnection.vbs
Created March 16, 2017 16:48
PagerDuty API connection test for Windows-based monitoring and integration tools.
' Copyright (c) 2016, PagerDuty, Inc. <info@pagerduty.com>
' All rights reserved.
'
' Redistribution and use in source and binary forms, with or without
' modification, are permitted provided that the following conditions are met:
' * Redistributions of source code must retain the above copyright
' notice, this list of conditions and the following disclaimer.
' * Redistributions in binary form must reproduce the above copyright
' notice, this list of conditions and the following disclaimer in the
' documentation and/or other materials provided with the distribution.
#!/usr/bin/env python
# Prints a list of PagerDuty incidents created on a given PagerDuty service over
# the past 24 hours.
import argparse
import time
try:
import pypd