Skip to content

Instantly share code, notes, and snippets.

View axolx's full-sized avatar
🐝

Martin Rio axolx

🐝
View GitHub Profile
@axolx
axolx / gist:4eb54de4b8a4714fcda4071ce333da02
Created September 9, 2016 15:15
uptimerobot.com API monitor add
#! /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python
import os
import argparse
import requests
import json
from pprint import pprint
# Requires evironment variable UPTIMEROBOT_API_KEY
@axolx
axolx / s3-cors-bucket.yaml
Created July 26, 2018 17:14
Sample CloudFormation stack for a bucket for AJAX uploads to S3
# Sample CloudFormation stack to create a bucket for AJAX uploads to S3
# Includes a lifecycle policy, CORS settings, and a IAM policy
# aws cloudformation create-stack --capabilities CAPABILITY_IAM --stack-name my-bucket --template-body file://s3-bucket.yaml --parameters ParameterKey=BucketName,ParameterValue=my-bucket ParameterKey=ExpirationDays,ParameterValue=2 ParameterKey=Role,ParameterValue=my-role
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
BucketName:
Type: String
Description: The name for the bucket
@axolx
axolx / sts_assume_role.bash
Last active October 4, 2022 23:48
A Bash function to assume an AWS role with MFA and update the awscli environment to the assumed role
sts_assume_role () {
read -p "Enter a current MFA token code: " token_code
role_credentials=`aws sts assume-role \
--role-arn <role-arn> \
--role-session-name <session-name> \
--serial-number <mfa-arn> \
--token-code ${token_code}`
export AWS_ACCESS_KEY_ID=$(echo $role_credentials | jq -r .Credentials.AccessKeyId)
export AWS_SECRET_ACCESS_KEY=$(echo $role_credentials | jq -r .Credentials.SecretAccessKey)
export AWS_SESSION_TOKEN=$(echo $role_credentials | jq -r .Credentials.SessionToken)
@axolx
axolx / etrm-api-request.py
Created February 26, 2021 00:31
Sample Python code for making requests to the eTRM API
#!/usr/bin/env python3
"""
Sample Python code for making requests to the eTRM API
"""
import http.client
import json
TOKEN = "SETME"
diff --git a/services/web/src/website/settings/base.py b/services/web/src/website/settings/base.py
index 25bb9c96..47edb55b 100644
--- a/services/web/src/website/settings/base.py
+++ b/services/web/src/website/settings/base.py
@@ -569,9 +569,21 @@ if os.getenv("SENTRY_DSN"):
return None
return event
+ # Set up Sentry distributed tracing
+ # see https://docs.sentry.io/platforms/python/performance/