Skip to content

Instantly share code, notes, and snippets.

View dsmrt's full-sized avatar
🤙
❤️

Damien Smrt dsmrt

🤙
❤️
View GitHub Profile
@dsmrt
dsmrt / docker-compose.yml
Last active February 8, 2018 17:18
Flipbox Docker LAMP for CraftCMS Dev
version: "3"
services:
web:
image: flipbox/php:71-amazonlinux-apache
ports:
- 80:80
#I have a self signed cert for local dev work
- 443:443
volumes:
- .:/var/www/html
@dsmrt
dsmrt / ElasticBeanstalkGetEnvironmentName.php
Last active August 4, 2016 04:58
I was surprised to see how it is to get the ElasticBeanstalk (EB) environment name from the EB instance. I wrote this quickly to fetch the name so I can run a switch on that, and have different configurations on different environments running crons.
<?php
$instanceId = file_get_contents('http://169.254.169.254/latest/meta-data/instance-id');
//I'd prefer to use the SDK here
exec('aws ec2 describe-instances --filters "Name=instance-id,Values='.$instanceId.'"',$results);
$instances = json_decode(implode(PHP_EOL,$results),true);
//fingers crossed
$tags = $instances['Reservations'][0]['Instances'][0]['Tags'];
@dsmrt
dsmrt / auth.conf
Last active July 25, 2016 16:46
Whitelist a IP using htauth (apahce 2.4) when it's behind a Elastic Load Balancer
<Directory "/var/www/html/public/">
DirectoryIndex index.php index.html index.htm
ErrorDocument 404 index.php
Options Indexes FollowSymLinks MultiViews
AllowOverride All
AuthType Basic
AuthName "My Protected Area"
AuthUserFile /path/to/authfile/.htpasswd
SetEnvIF X-Forwarded-For "0.0.0.0" AllowIP #change 0.0.0.0 to your whitelisted ip
<RequireAny>
@dsmrt
dsmrt / README.md
Created February 23, 2016 18:08 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage