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
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.
Resources:
DummyCluster:
Type: AWS::ECS::Cluster
@bsamuel-ui
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: https://github.com/serverless/serverless/issues/1439
@bsamuel-ui
bsamuel-ui / many_uniform_plots.py
Created Apr 5, 2018
Run many log plots of a uniform distribution
View many_uniform_plots.py
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
bsamuel-ui / proposal.py
Last active Feb 14, 2018
Simple syntax for attrs validation
View proposal.py
import attr
class AutoValidator:
_expr = None
_counter = 0
def _newvar(self):
num = AutoValidator._counter
AutoValidator._counter += 1
return f'_v{num}'
@bsamuel-ui
bsamuel-ui / test_log_name_bug.py
Last active Aug 24, 2017
Test if cloudformation can create stacks with CW log groups with the same name
View test_log_name_bug.py
template = '''
Resources:
LambdaLogGroup1234:
Type: "AWS::Logs::LogGroup"
Properties:
LogGroupName: !Join [ "", [ "/aws/lambda/", !Ref "AWS::StackName", "1234" ] ]
LambdaLogGroup:
Type: "AWS::Logs::LogGroup"
Properties:
You can’t perform that action at this time.