Skip to content

Instantly share code, notes, and snippets.

View crichardson9's full-sized avatar
🎯
Focusing

Chris Richardson crichardson9

🎯
Focusing
View GitHub Profile
@rhukster
rhukster / sphp.sh
Last active March 30, 2024 10:41
Easy Brew PHP version switching (Now moved to https://github.com/rhukster/sphp.sh)
#!/bin/bash
# Creator: Phil Cook
# Modified: Andy Miller
#
# >>> IMPORTANT: Moved to: https://github.com/rhukster/sphp.sh
# >>> Kept here for legacy purposes
#
osx_major_version=$(sw_vers -productVersion | cut -d. -f1)
osx_minor_version=$(sw_vers -productVersion | cut -d. -f2)
osx_patch_version=$(sw_vers -productVersion | cut -d. -f3)
@jthomerson
jthomerson / delete-all-cloudsearch-documents.sh
Created April 24, 2017 14:50
Delete all CloudSearch documents in a given domain
#!/bin/bash
# This script will delete *all* documents in a CloudSearch domain.
# USE WITH EXTREME CAUTION
# Note: depends on the AWS CLI SDK being installed, as well as jq
# For jq, see: https://stedolan.github.io/jq/ and https://jqplay.org/
if [[ ! $# -eq 2 || $1 != "--doc-domain" || ! $2 =~ ^https://.*$ ]]; then
echo "Must define --doc-domain argument (e.g. --doc-domain https://somedomain.aws.com)";
@maxkostinevich
maxkostinevich / php-fpm-restart.sh
Last active February 17, 2022 17:40
Cloudways PHP-FPM restart via API
# Restart PHP-FPM on CloudWays via API
# Replace YOUR_NAME%40DOMAIN.COM with your email (URL-encoded), YOUR_API_KEY with your Cloudways API key and SERVER_ID with id of your server
# If you want to use it with DeployBot just add the following commands to the "Run commands after new version becomes active" section.
# Do auth and receive access_token
cloudways_token=$(curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'email=YOUR_NAME%40DOMAIN.COM&api_key=YOUR_API_KEY' 'https://api.cloudways.com/api/v1/oauth/access_token' | python3 -c "import sys, json; print(json.load(sys.stdin)['access_token'])")
# Restart PHP-FPM
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --header "Authorization: Bearer ${cloudways_token}" -d 'server_id=SERVER_ID&service=php7.0-fpm&state=restart' 'https://api.cloudways.com/api/v1/service/state'
@vluzrmos
vluzrmos / compat_l5.php
Last active November 1, 2022 20:43
Lumen L5 compatibility helpers. That file should be added on root path of your project... and added to your composer.json
<?php
if(!function_exists('config_path'))
{
/**
* Return the path to config files
* @param null $path
* @return string
*/
function config_path($path=null)