Skip to content

Instantly share code, notes, and snippets.

Working from home

Chris Fidao fideloper

Block or report user

Report or block fideloper

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
fideloper /
Created Dec 19, 2018
Quick and dirty monitoring of mysql connections
#!/usr/bin/env bash
# 5 minutes between alerts
# Track when we sent the last alert
while true; do
NUMBER_CONNECTIONS=$(mysql --defaults-extra-file=/data/.prod.cnf -sNe "select count(*) as connection_count from INFORMATION_SCHEMA.PROCESSLIST;")
fideloper /
Created Mar 17, 2018
write up on transactions

What we're demonstrating here is that it's probably smart to do most database operations in a transaction, even SELECT statements.

Mac Linux Windows
Install Docker on Mac Install Docker on Debian Not Currently Supported
Install Docker on Ubuntu
Install Docker on CentOS
fideloper / stream_file.php
Last active Apr 30, 2019
Stream file from S3 to browser, assume Laravel Filesystem usage
View stream_file.php
* Get File Information
// Assuming these come from some data source in your app
$s3FileKey = 's3/key/path/to/file.ext';
$fileName = 'file.ext';
fideloper /
Last active Dec 19, 2018
Enable/Disable xDebug depending on env.
#!/usr/bin/env bash
# A CMD or ENTRYPOINT script for a Dockerfile to use to start a Nginx/PHP-FPM
# For more details, see 🐳
if [ ! "production" == "$APP_ENV" ] && [ ! "prod" == "$APP_ENV" ]; then
# Enable xdebug
fideloper / convert_attach_from_db_to_file.php
Last active Dec 7, 2016
Converting Database Stored Attachments to the File System
View convert_attach_from_db_to_file.php
* Notes:
* This script will convert attachments from being stored on the DB to the file system
* NOTE: This script removes the atachments from your database. Before running this script make a backup. For real.
//No time limit
fideloper / develop
Created Nov 24, 2016
Helper for Laravel + Docker dev workflow
View develop
#!/usr/bin/env bash
# Set environment variables for dev
export APP_ENV=local
export APP_PORT=80
export DB_PORT=3306
export DB_ROOT_PASS=secret
export DB_NAME=homestead
export DB_USER=homestead
export DB_PASS=secret
fideloper /
Created Nov 4, 2016
Change many aws instances tags (boto3)
import boto3
import sys
ec2 = boto3.client('ec2')
# Grab where backup retention is 14 days so we can reduce it to 7
instances = ec2.describe_instances(Filters=[{'Name': 'tag:Retention', 'Values': ['14']}])
ids = []
fideloper /
Created Jun 27, 2016
Provision ubuntu 16.04 vagrant machine
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get -y upgrade
# Get "add-apt-repository" Command
sudo apt-get install -y software-properties-common
You can’t perform that action at this time.