Skip to content

Instantly share code, notes, and snippets.

View hayd's full-sized avatar
😎
chillin'

Andy Hayden hayd

😎
chillin'
View GitHub Profile
@hayd
hayd / elastic-beanstalk-log-prefix.md
Last active June 27, 2023 12:28
Modify elastic beanstalk default log output prefix

By default elastic beanstalk logs are prefixed by the date and the ip. This is may not be desired, either because the date is also in the logs or because the timestamp is included in cloudwatch logs metadata.

We can remove it by adding two hooks (both with the same content):

  • .platform/hooks/predeploy/10_logs.sh
  • .platform/confighooks/predeploy/10_logs.sh

Note: You must ensure these are executable before packaing (chmod +x).

@hayd
hayd / tag_volume.config
Last active August 11, 2021 17:23
Tag Volumes in Elastic Beanstalk
container_commands:
tagVolume:
command: aws ec2 create-tags --resources $(aws ec2 describe-instances --region $(curl http://169.254.169.254/latest/meta-data/placement/availability-zone| sed 's/[a-z]$//') --instance-id $(curl http://169.254.169.254/latest/meta-data/instance-id ) --output text --query Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId) --region $(curl http://169.254.169.254/latest/meta-data/placement/availability-zone| sed 's/[a-z]$//') --tags Key=Name,Value=$(/opt/elasticbeanstalk/bin/get-config container -k environment_name)
#!/usr/bin/env zsh
# Nothing theme with the counter removed
NT_PROMPT_SYMBOL=❱
function precmd(){
autoload -U add-zsh-hook
setopt prompt_subst
@hayd
hayd / Dockerfile
Last active January 6, 2019 03:05
deno-docker
FROM hayd/deno:alpine-0.2.5
EXPOSE 1993
WORKDIR /app
ADD . /app
ENTRYPOINT ["deno", "--allow-net", "main.ts"]
@hayd
hayd / alpine.Dockerfile
Last active September 10, 2019 17:01
deno-docker
FROM frolvlad/alpine-glibc:alpine-3.8
ENV DENO_VERSION=0.2.5
RUN apk add --no-cache curl && \
curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno_linux_x64.gz --output deno.gz && \
gunzip deno.gz && \
chmod 777 deno && \
mv deno /bin/deno && \
apk del curl
import os
import pty
import select
import subprocess
# Example:
# tty_capture(["python", "test.py"], b"abc\n")
# (b'stdin: True, stdout: True, stderr: True\r\n',
# b'read from stdin: abc\r\n')
@hayd
hayd / http-redirect-target.php
Created May 8, 2018 16:45
Get HTTP redirect destination for a URL in PHP
<?php
// FOLLOW A SINGLE REDIRECT:
// This makes a single request and reads the "Location" header to determine the
// destination. It doesn't check if that location is valid or not.
function get_redirect_target($url)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
@hayd
hayd / README.md
Created March 25, 2017 00:43 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


def foo():
print("one tab")
print("eight spaces")
@hayd
hayd / sns-to-slack.py
Created May 5, 2016 06:47
sns to slack aws lambda python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Follow these steps to configure the webhook in Slack:
1. Navigate to https://<your-team-domain>.slack.com/services/new
2. Search for and select "Incoming WebHooks".