Skip to content

Instantly share code, notes, and snippets.

import requests
import requests_mock
def match_limited(request):
return '"Limit":10' in request.text
def match_limitless(request):
return '"Limit":10' not in request.text
limited_response = "limited"
@jamielennox
jamielennox / gist:ec78a28ab79485dadf0a7bb0bc25b15b
Created February 16, 2018 03:20
PagerDuty V2 - Sumo Integration
{
"routing_key": "XXXXXXXXXXX",
"event_action": "trigger",
"payload": {
"summary": "Search '$SearchName' fired an alert on 'Test Service' in SumoLogic.",
"source": "sumologic",
"severity": "info",
"custom_details": {
"name": "Sumo: $SearchName",
"description": "$SearchDescription",
@jamielennox
jamielennox / test_thing.py
Created October 19, 2017 03:10
requests_mock and pytest
import thing
import pytest
import requests_mock as rm_module
@pytest.fixture
def requests_mock(request):
m = rm_module.Mocker()
m.start()
[mynewauth]
auth_type=password
auth_url=https://keystone.test.com
username=user
password=pass
project_name=proj
default_domain_name=domain
body = """
{
"action": "opened",
"number": 13,
"pull_request": {
"url": "https://api.github.com/repos/BonnyCI/sandbox/pulls/13",
"id": 97212551,
"html_url": "https://github.com/BonnyCI/sandbox/pull/13",
"diff_url": "https://github.com/BonnyCI/sandbox/pull/13.diff",
FROM ubuntu:latest
MAINTAINER Jamie Lennox <jamielennox@gmail.com>
RUN apt-get update && \
apt-get install -y gcc git python2.7 python2.7-dev wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
wget -O- https://bootstrap.pypa.io/get-pip.py | python2.7
RUN groupadd -r zuul && \
contrasjc-bastion ansible_ssh_host=169.45.80.29
[bastion]
contrasjc-bastion
@jamielennox
jamielennox / service_token_test.conf
Created November 3, 2016 01:19
Test out using ServiceTokenAuthWrapper.
# there's no particular reason i used nova creds for auth_token, they just exist already
# auth_section simply points one section to the other rather than repeat it
[keystone_authtoken]
auth_uri = http://localhost/identity
auth_section = service_auth
[service_auth]
auth_type = password
auth_url = http://localhost/identity
import array
import timeit
import numpy
import sys
mask = [0x71, 0x45, 0x54, 0x82]
mask_str = ''.join(chr(m) for m in mask)
def time_numpy(data):

Keybase proof

I hereby claim:

  • I am jamielennox on github.
  • I am jamielennox (https://keybase.io/jamielennox) on keybase.
  • I have a public key ASDhrFG-nUs_MVzzMuWWKbSyE-INeA5qZRGMhNRtT04oXgo

To claim this, I am signing this object: