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
View chipper_box.md

The pipeline could use a selection of pre-set features.

Goals

  1. Give the pipeline more polish by allowing users to "build" their pipeline (preset items they can run)
  2. Make Chipper feel more integrated with services such as AWS, Forge, Envoyer, Vapor
  3. Make it easier to script more complex items such as conditional actions, or creating build artifacts

It might be nice to have a way to have icons for each as well - PHP, NodeJS, Composer, Dusk, Vapor, etc etc etc.

View prom.yml
groups:
- name: node_rules
rules:
- record: instance:node_cpu:avg_rate5m
expr: 100 - avg (irate(node_cpu_seconds_total{job="helpspot-cloud", mode="idle"}[5m])) by (instance) * 100
View coverage.php
#!/usr/bin/env php
<?php
// coverage-checker.php
$inputFile = $argv[1];
$percentage = min(100, max(0, (int) $argv[2]));
if (!file_exists($inputFile)) {
throw new InvalidArgumentException('Invalid input file provided');
}
@fideloper
fideloper / sqlite3.sh
Last active Nov 17, 2019
update sqlite on ubuntu 18.04 to version 2.30
View sqlite3.sh
#!/usr/bin/env bash
# Reference:
# https://stackoverflow.com/questions/9646353/how-to-find-sqlite-database-file-version
# Go to a known directory so we can cleanup files later
cd ~
# Download
wget https://www.sqlite.org/2019/sqlite-autoconf-3300100.tar.gz
@fideloper
fideloper / .zshrc
Created Jun 21, 2019
Defer loading of NVM to increase new terminal init speed
View .zshrc
# Thanks to https://www.growingwiththeweb.com/2018/01/slow-nvm-init.html, 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/nvm.sh" ] && [ ! "$(type -w __init_nvm | awk '{print $2}')" = function ]; then
@fideloper
fideloper / connections.sh
Created Dec 19, 2018
Quick and dirty monitoring of mysql connections
View connections.sh
#!/usr/bin/env bash
# 5 minutes between alerts
SECONDS_BETWEEN_ALERTS=300
# Track when we sent the last alert
LAST_ALERT=0
while true; do
NUMBER_CONNECTIONS=$(mysql --defaults-extra-file=/data/.prod.cnf -sNe "select count(*) as connection_count from INFORMATION_SCHEMA.PROCESSLIST;")
@fideloper
fideloper / transactions.md
Created Mar 17, 2018
write up on transactions
View transactions.md

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

View tables.md
Mac Linux Windows
Install Docker on Mac Install Docker on Debian Not Currently Supported
Install Docker on Ubuntu
Install Docker on CentOS
@fideloper
fideloper / stream_file.php
Last active May 18, 2020
Stream file from S3 to browser, assume Laravel Filesystem usage
View stream_file.php
<?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
fideloper / start-container.sh
Last active Feb 7, 2020
Enable/Disable xDebug depending on env.
View start-container.sh
#!/usr/bin/env bash
###
# A CMD or ENTRYPOINT script for a Dockerfile to use to start a Nginx/PHP-FPM
#
# For more details, see 🐳 https://shippingdocker.com
##
if [ ! "production" == "$APP_ENV" ] && [ ! "prod" == "$APP_ENV" ]; then
# Enable xdebug
You can’t perform that action at this time.