Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
chillin'

Andy Hayden hayd

😎
chillin'
View GitHub Profile
@hayd
hayd / elastic-beanstalk-log-prefix.md
Last active May 6, 2023 14:07
Modify elastic beanstalk default log output prefix
View elastic-beanstalk-log-prefix.md

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
View tag_volume.config
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)
View less-than-nothing.zsh-theme
#!/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
View Dockerfile
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
View alpine.Dockerfile
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
View capture_tty.py
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
View http-redirect-target.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
View README.md


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


View invalid.py
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
View sns-to-slack.py
#!/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".