Skip to content

Instantly share code, notes, and snippets.

Working from home

Chris Fidao fideloper

Working from home
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 / .zshrc
Created Jun 21, 2019
Defer loading of NVM to increase new terminal init speed
View .zshrc
# Thanks to, modified
# for zsh as "type -t" works in bash but not zsh
# Add this to your .zshrc ...
# Defer initialization of nvm until nvm, node or a node-dependent command is
# run. Ensure this block is only run once if .bashrc gets sourced multiple times
# by checking whether __init_nvm is a function.
if [ -s "$HOME/.nvm/" ] && [ ! "$(type -w __init_nvm | awk '{print $2}')" = function ]; then
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 Oct 9, 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 Aug 2, 2019
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 = []
You can’t perform that action at this time.