This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ======= WAF | |
// Based on this example: https://docs.aws.amazon.com/waf/latest/developerguide/waf-using-managed-rule-groups.html | |
const acl = new waf.CfnWebACL(this, "WebAcl", { | |
defaultAction: { allow: {} }, | |
scope: "REGIONAL", | |
visibilityConfig: { | |
cloudWatchMetricsEnabled: true, | |
metricName: "MyMetric", | |
sampledRequestsEnabled: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class LongMessage extends React.Component { | |
componentDidMount() { | |
const newMessagesIndicator = document.getElementsByClassName('bpw-new-messages-indicator')[0] | |
// If the "New Messages" div is present, we should not auto-scroll | |
if (!newMessagesIndicator) { | |
const messagesList = document.getElementsByClassName('bpw-msg-list')[0] | |
messagesList.scrollTop = messagesList.scrollHeight | |
} | |
} | |
render() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GH_TOKEN=$1 | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=1\&per_page\=100 | jq -r '.[] | .name' >> repos.txt | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=2\&per_page\=100 | jq -r '.[] | .name' >> repos.txt | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=3\&per_page\=100 | jq -r '.[] | .name' >> repos.txt | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=4\&per_page\=100 | jq -r '.[] | .name' >> repos.txt | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=5\&per_page\=100 | jq -r '.[] | .name' >> repos.txt | |
curl -s -H "Authorization: token $GH_TOKEN" https://api.github.com/users/sindresorhus/repos\?page\=6\&per_page\=100 | jq -r '.[] | .name' >> repos.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
yum -y install mysql # provisioning example | |
# Signal that the instance is ready | |
INSTANCE_ID=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id` | |
aws ec2 create-tags --resources $INSTANCE_ID --tags Key=UserDataFinished,Value=true --region ${AWS::Region} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MyAMI: | |
Type: Custom::AMI | |
Properties: | |
ServiceToken: !ImportValue AMILambdaFunctionArn | |
Image: | |
Name: my-image | |
Description: some description for the image | |
TemplateInstance: | |
ImageId: ami-467ca739 | |
IamInstanceProfile: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: A serverless Gift Idea as a Service API | |
Resources: | |
MyApi: | |
Type: AWS::Serverless::Api | |
Properties: | |
StageName: prod | |
DefinitionBody: | |
swagger: 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import random | |
from collections import namedtuple | |
Object = namedtuple(field_names=['determiner', 'object'], typename='Object') | |
objects = [ | |
Object('A', 'Star Wars Mug'), | |
Object('A', 'Mickey Mouse Toaster'), | |
Object('Some', 'Socks'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import uuid | |
from botocore.vendored import requests | |
SUCCESS = "SUCCESS" | |
FAILED = "FAILED" | |
class HeartbeatAlreadyExistsError(Exception): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Provisions OpsGenie Heartbeats using CloudFormation | |
Parameters: | |
OpsGenieHeartbeatApiKey: | |
Type: String | |
NoEcho: true | |
Resources: | |
HeartbeatLambdaExecutionRole: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Html exposing (div, button, text, input) | |
import Html.Events exposing (onClick) | |
import StartApp.Simple as StartApp | |
main = | |
StartApp.start { model = model, view = view, update = update } | |
model = 0 |
NewerOlder