Skip to content

Instantly share code, notes, and snippets.

View mrpatrick's full-sized avatar

Patrick Tully mrpatrick

View GitHub Profile
@mrpatrick
mrpatrick / _config_with_redcarpet.yml
Created September 25, 2013 21:24
Add to jekyll config to enable redcarpet with extensions (Github flavored markdown)
markdown: redcarpet
redcarpet:
extensions: ["no_intra_emphasis", "fenced_code_blocks", "autolink", "tables", "with_toc_data"]
$ travis encrypt S3_ACCESS_KEY_ID=asdlfkjsadf --add env.global
$ travis encrypt S3_SECRET_KEY=kajsdflkjasdfk --add env.global
@mrpatrick
mrpatrick / ssl_check_expire_days.py
Last active September 8, 2020 07:39
Updated to use OpenSSL and cert tags as subprocess no longer works with latest dd-agent
import time
import datetime
from OpenSSL import crypto as c
from checks import AgentCheck
class SSLCheckExpireDays(AgentCheck):
def check(self, instance):
metric = "ssl.expire_in_days"
certfile = instance['cert']
cert_tag = 'cert:%s' % (certfile.split('/')[-1:],)
<script type="text/javascript">
var addthis_config = {
data_ga_property: 'UA-123456-1',
data_ga_social : true
};
</script>
http://chart.apis.google.com/chart?cht=qr&chs=500x500&choe=UTF-8&chld=H&chl=[HTTP_URL_HERE]
curl -X POST https://identity.api.rackspacecloud.com/v2.0/tokens -d '{ "auth":{ "passwordCredentials":{ "username":"$USER", "password":"$PASSWORD"}}}' -H "Content-type: application/json"
LogFormat "%s %h %l %u %t \"%r\" %b" splunk
CustomLog "|stdbuf -o0 /bin/grep --invert-match '^200' | /usr/sbin/rotatelogs /var/log/apache2/splunk-access.log 86400" splunk
@mrpatrick
mrpatrick / apache_piped_json_errors.conf
Created October 31, 2013 21:19
Apache Piped JSON excluding 2xx and 3xx statuses
# JSON extended log format including: User-Agent, Referer, and X-Forwarded-For
LogFormat "{ \"time\":\"%t\", \"remoteIP\":\"%a\", \"host\":\"%V\", \"request\":\"%U\", \"query\":\"%q\", \"method\":\"%m\", \"status\":\"%>s\", \"userAgent\":\"%{User-agent}i\", \"referer\":\"%{Referer}i\", \"X-Forwarded-For\":\"%{X-Forwarded-For}i\" }" jsonlog
# Pipe only warnings/errors to json log file
CustomLog "|/bin/grep -E --invert-match --line-buffered 'status.?[[:punct:]].?[23]' |cat >> /var/log/httpd/errors.json" jsonlog
{ "messages": [ { "id": "bb8b8fe0-e8d5-11e2-9c1e-22000afd16cf", "created_on": "2013-07-09T20:25:44Z", "type": "incident.trigger", "data": { "incident": { "id": "PIJ90N7", "incident_number": 1, "created_on": "2013-07-09T20:25:44Z", "status": "triggered", "html_url": "http://acme.pagerduty.com/incidents/PIJ90N7", "incident_key": "null", "service": { "id": "PBAZLIU", "name": "service", "html_url": "http://acme.pagerduty.com/services/PBAZLIU" }, "assigned_to_user": { "id": "PPI9KUT", "name": "Alan Kay", "email": "[email protected]", "html_url": "http://acme.pagerduty.com/users/PPI9KUT" }, "trigger_summary_data": { "subject": "45645" }, "trigger_details_html_url": "http://acme.pagerduty.com/incidents/PIJ90N7/log_entries/PIJ90N7", "last_status_change_on": "2013-07-09T20:25:
<?php
use \avatarnewyork\pagerdutysayswebhook; include("classes/pagerdutysays.php");
$pds = new pagerdutysayswebhook\PagerDutySays($HTTP_RAW_POST_DATA);
$pds->enableAirPlay(true);
$pds->say();
?>