Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View christhomas's full-sized avatar
💭
when you're happy and you know it, don't build a mailserver *clap clap*

Christopher Thomas christhomas

💭
when you're happy and you know it, don't build a mailserver *clap clap*
View GitHub Profile
@christhomas
christhomas / scr_to_gif.sh
Last active May 13, 2020 07:38
Easy script to convert a video into a GIF. Great for screen-recordings that can be shared in bug tickets
#!/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" \
@christhomas
christhomas / gist:ea90cc55502a3f804f0b6a8e59d05e60
Created September 17, 2019 07:55
How to use the terraform workspace command to keep multiple state configurations without clashing
#!/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]}
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"]
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
}
});