This file contains hidden or 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
| # Will take a command line and extract only the parts of the command line that are the arguments for a given subcommand | |
| # I needed this to extract something similar to this | |
| # ./bin/myprogram subcommand_a subcommand_b -a --bee -c -f subcommand_c --bee -f subcommand_d -f | |
| # I needed the -a, --bee, -f | |
| # Or if the user wrote this: -acf --bee or -ac --bee -f or combinations of single dashed parameters | |
| # But I can't just search the command for -f, because -f is given to subcommand_[b/c/d] so a raw search might "find" the wrong -f argument | |
| # Example, given the command: ./bin/myprogram subcommand_a subcommand_b -a --bee -c subcommand_c --bee -f subcommand_d -f | |
| # Then searching for -f would find the -f from subcommand_c, but it was not given as an argument to subcommand_b | |
| # So I wanted a function that would give me ONLY the arguments following a particular subcommand, ignoring similar arguments given to other subcommands that might follow later in the command string |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| self=$(basename $0) | |
| [ "$1" = "help" ] && [ ! -f "$1" ] \ | |
| && echo -e "scr_to_gif: v1.0" \ | |
| && echo -e "usage: ${self} <filename.mov> <scale> <speed>\n" \ | |
| && echo -e "scale: - Range 100-9999" \ | |
| && echo -e " - A single number to denote the desired width, the height will be automatic. E.g: 300, 500, 640, 800, 1024, 1280, 1600" \ | |
| && echo -e " - Also both dimensions with numbers within range. Separated by a colon. Example: 100:100, 512,512, 800:600" \ |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # usage: chris-terraform ... (any terraform command you want) | |
| role=XYZ | |
| credentials=(`aws sts assume-role --role-arn "${role}" --role-session-name terraform --query '[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]' --output text`) | |
| AWS_ACCESS_KEY_ID=${credentials[0]} | |
| AWS_SECRET_ACCESS_KEY=${credentials[1]} | |
| AWS_SESSION_TOKEN=${credentials[2]} | |
| AWS_SECURITY_TOKEN=${credentials[2]} |
This file contains hidden or 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
| variable "stage_name" { | |
| value = "default" | |
| } | |
| resource "aws_api_gateway_domain_name" "main" { | |
| domain_name = "whatever.domain.com" | |
| regional_certificate_arn = "arn:aws:acm:us-west-2:accountID:certificate/certID" | |
| endpoint_configuration { | |
| types = ["REGIONAL"] |
This file contains hidden or 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
| class InputField extends React.Component<InputFieldProps, any> | |
| { | |
| componentDidMount() | |
| { | |
| // Manually trigger validation rules to test whether the values set are ok or not | |
| this.props.onChange({ | |
| target:{ | |
| value:this.props.value | |
| } | |
| }); |