Skip to content

Instantly share code, notes, and snippets.

View stavxyz's full-sized avatar
🫠

samuel stavxyz

🫠
View GitHub Profile
@stavxyz
stavxyz / playground.md
Last active January 24, 2019 21:59
Github Flavored Markdown Playground

What if I want my link to be fixed width?

[`something/like/a/path`](https://google.com)

result

something/like/a/path

@stavxyz
stavxyz / build.sh
Last active October 4, 2018 17:00
terraform & lambda - source code in s3. support for apigateway integration, xray and logging
#! /usr/bin/env bash
# Exit script if you try to use an uninitialized variable.
set -o nounset
# Exit script if a statement returns a non-true return value.
set -o errexit
# Use the error status of the first failure, rather than that of the last item in a pipeline.
set -o pipefail
@stavxyz
stavxyz / publicSubnets.go
Last active August 21, 2020 15:13
finding public subnets in go
package main
import (
"fmt"
"sort"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
@stavxyz
stavxyz / awslblogs.py
Last active April 10, 2018 19:04
stream logs from an ELB or an ALB (it determines this for you). pipe to `jq` to find 5xx's or whatever (requires python3)
#! /usr/bin/env python
"""
# this one has load balancer name
# and does not end in gz
bucket[/prefix]/AWSLogs/aws-account-id/elasticloadbalancing/region/yyyy/mm/dd/aws-account-id_elasticloadbalancing_region_load-balancer-name_end-time_ip-address_random-string.log
# this one has load balancer ID
# and ends in gz
@stavxyz
stavxyz / query_params.py
Last active April 3, 2017 22:57
All the code you need to mess with query params successfully. Works for pretty much any scenario, including python 2 AND 3.
#
# This is for python 2/3 compatibility.
#
try:
import urlparse
from urllib import urlencode
except:
import urllib.parse as urlparse
from urllib.parse import urlencode
@stavxyz
stavxyz / wff.py
Created March 2, 2017 19:59
Get details on SWF workflow failures
import json
import time
import boto3
# aws swf list-closed-workflow-executions
# --domain $SWF_DOMAIN
# --type-filter name=$WORKFLOW_NAME
@stavxyz
stavxyz / bootstrap_tf
Last active March 6, 2023 14:27
Bootstrap terraform remote config 🐔 🥚
tf plan -target=aws_s3_bucket.tf_remote_config_bucket -out=confbucket.plan
tf apply confbucket.plan
# Configure against your new bucket.
terraform remote config -backend="S3" \
-backend-config="bucket=project-name-terraform-state" \
-backend-config="key=env-region-terraform-state/terraform.tfstate" \
-backend-config="region=us-west-2" \
-backend-config="encrypt=1"
@stavxyz
stavxyz / sjs.md
Last active November 6, 2018 17:01
Shit Janus Says

mozair

this hopefully won't break all the things we've ever built

integration tests passed
I don't know if I should be happy or sad

On the release of AWS Edge Location in Vienna

schnitzel shops rejoice

@stavxyz
stavxyz / a.py
Last active May 22, 2016 21:29
pyenv versions regex
# hello
@stavxyz
stavxyz / b.py
Created April 8, 2016 16:54
to the buildbox!
# /usr/bin/env python