Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block andybeak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
andybeak / Dockerfile
Created Dec 4, 2019
Lab 4 - Laravel in ECS
View Dockerfile
FROM php:7.2-apache
COPY --chown=www-data:www-data . /var/www/html/
COPY Docker/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY Docker/php.ini-development /usr/local/etc/php/php.ini
WORKDIR /var/www/html/
andybeak / fingerscrossed.php
Created Dec 3, 2019
Monolog fingerscrossed handler
View fingerscrossed.php
// composer require monolog/monolog
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\FingersCrossedHandler;
use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy;
andybeak /
Last active Nov 21, 2019
Set up firewall for webserver behind a reverse proxy #book #course
logger Configuring iptables
# Flush existing rules
sudo iptables -F
# Allow SSH from bastion server
sudo iptables -A INPUT -p tcp -s --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
andybeak /
Last active Nov 30, 2019
Get AWS Ubuntu Linux VM ready for remote development #book #course
sudo apt update && sudo apt upgrade -y
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
andybeak / index.php
Created Nov 12, 2019
Blog article on monolog to ELK #blog
View index.php
use Monolog\Logger;
use Monolog\Handler\SocketHandler;
// create a log channel
$log = new Logger('elk');
andybeak / logout.php
Last active Oct 21, 2019
Log out a user using server-side sessions
View logout.php
// can't log out if the session isn't started
// emptying the session data is useful if your script continues running after logging out
$_SESSION = [];
// set the cookie to expire immediately
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
andybeak / nginx_tls.conf
Last active Nov 22, 2019
Nginx TLS config #book
View nginx_tls.conf
server {
listen 443 ssl;
ssl on;
# enable HSTS
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains;";
# prevent clickjacking
add_header X-Frame-Options "SAMEORIGIN";
andybeak / nginx.conf
Last active Aug 22, 2019
nginx cors allow origins #course #book
View nginx.conf
// See
// This sets the value of $cors_header depending on the value of $http_origin
map $http_origin $cors_header{
default "";
"~^(https:\/\/safedomain\.com)$" "$http_origin";
"~^(https:\/\/anotherdomain\.com)$" "$http_origin";
server {
listen 80;
View gist:3817d12fb94af49b3d6037c2f0eca134
// Answer from
$safe_path = escapeshellarg($_FILES['uploadedfile']['tmp_name']);
$command = 'clamscan ' . $safe_path;
$out = '';
$int = -1;
exec($command, $out, $int);
andybeak / docker-compose.yml
Created Mar 21, 2019
NomadPHP php speed comparison demo
View docker-compose.yml
version: '3'
image: nginx:1.13.1
container_name: nginx-proxy
- "80:80"
- "443:443"
- conf:/etc/nginx/conf.d
You can’t perform that action at this time.