Skip to content

Instantly share code, notes, and snippets.


Ben Samuel bsamuel-ui

Block or report user

Report or block bsamuel-ui

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bsamuel-ui / test-ecs-cf-bug.yaml
Created Mar 27, 2019
Test for fix of ECS long ARN GetAttr bug in Cloudformation
View test-ecs-cf-bug.yaml
AWSTemplateFormatVersion: 2010-09-09
Description: >-
A test case for the GetAttr bug with ECS's long ARNs. When this is fixed,
if you are opted in to long ARNs, the output ServiceName should be 'stack-Service-texttext'
and not equal to ClusterName.
Type: AWS::ECS::Cluster
bsamuel-ui / serverless-deploy-user.yaml
Last active Jan 23, 2019
Cloudformation template to deploy permissions for deploying a serverless project.
View serverless-deploy-user.yaml
AWSTemplateFormatVersion: 2010-09-09
Description: >
Constructs a managed IAM policy to deploy a serverless project.
This template assumes the stack is being deployed in the current region and account.
You can then attach this policy to other IAM objects, such as users or roles.
Based on the work done in:
bsamuel-ui /
Created Apr 5, 2018
Run many log plots of a uniform distribution
import numpy as np
%matplotlib inline
from seaborn import tsplot
stars_planets = np.sort(0.05 + np.random.rand(100, 8), axis=1)
tsplot(np.log(stars_planets), err_style='unit_traces')
bsamuel-ui /
Last active Feb 14, 2018
Simple syntax for attrs validation
import attr
class AutoValidator:
_expr = None
_counter = 0
def _newvar(self):
num = AutoValidator._counter
AutoValidator._counter += 1
return f'_v{num}'
bsamuel-ui /
Last active Aug 24, 2017
Test if cloudformation can create stacks with CW log groups with the same name
template = '''
Type: "AWS::Logs::LogGroup"
LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName", "1234" ] ]
Type: "AWS::Logs::LogGroup"
You can’t perform that action at this time.