Skip to content

Instantly share code, notes, and snippets.

View jwhulette's full-sized avatar
🏠
Working from home

Wes Hulette jwhulette

🏠
Working from home
View GitHub Profile
@jwhulette
jwhulette / www.conf
Last active July 27, 2022 13:02
[www.conf] A base php-fpm www.conf file #php
; See https://spot13.com/pmcalculator/ for configuration
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
@jwhulette
jwhulette / php-fpm-settings.txt
Last active July 27, 2022 14:37
[PHP-FPM: Configure Settings] How to set the PHP-FPM servers configuration #php
PHP-FPM: Settings
1. How much memory each PHP FPM process is consuming:
ps --no-headers -o "rss,cmd" -C php-fpm | awk '{ sum+=$1 } END { printf ("%d%s\n", sum/NR/1024,"M") }'
2. Server ram:
free -h
Use: https://spot13.com/pmcalculator/
or
@jwhulette
jwhulette / Laravel Custom Rate Limiter
Last active July 27, 2022 13:03
[Laravel Custom Rate Limiter] #php #laravel
<?php
declare(strict_types=1);
namespace App\Traits;
use Closure;
use Illuminate\Cache\RateLimiter;
/**
@jwhulette
jwhulette / laravel_api.txt
Last active July 27, 2022 13:03
[Larvel to API] Remove items from Laravel to make it API specific #laravel
Remove package.json
Remove webpack.mix.js
Remove /resources
Remove /routes/web.php
Remove welcome.blade.php
Remove api route prefix so that API routes are at the root path
Comment out web middleware in HTTP Kernel
Adjust exception hanlder to always return JSON
@jwhulette
jwhulette / Laravel dynamic log path
Last active July 25, 2021 23:00
[Laravel dynamic log path] #php #laravel
$handler = new StreamHandler($path);
$handler->setFormatter(new LineFormatter(null, "Y-m-d H:i:s", true, true));
Log::channel('upkfile')->getLogger()->popHandler();
Log::channel('upkfile')->getLogger()->pushHandler($handler);
@jwhulette
jwhulette / Laravel Zero Hide Commands
Last active July 25, 2021 22:59
[Laravel Zero Hide Commands] #laravel #php
'hidden' => Phar::running() ? [
NunoMaduro\Collision\Adapters\Laravel\Commands\TestCommand::class,
NunoMaduro\LaravelConsoleSummary\SummaryCommand::class,
Symfony\Component\Console\Command\HelpCommand::class,
LaravelZero\Framework\Commands\MakeCommand::class,
LaravelZero\Framework\Commands\BuildCommand::class,
LaravelZero\Framework\Commands\InstallCommand::class,
LaravelZero\Framework\Commands\RenameCommand::class,
LaravelZero\Framework\Commands\StubPublishCommand::class,
Illuminate\Console\Scheduling\ScheduleRunCommand::class,
@jwhulette
jwhulette / .eslintrc.js
Last active July 25, 2021 23:02
[Vue VSCode setup] #vscode #vuejs
module.exports = {
root: true,
env: {
browser: true,
},
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
},
extends: [
@jwhulette
jwhulette / CronSchedule.php
Last active June 20, 2020 14:50 — forked from m4tthumphrey/CronSchedule.php
[CronSchedule] Allows one to parse a cron expression into human readable text. #php
<?php
namespace App\Models\Common;
/*
* Plugin: StreamlineFoundation
*
* Class: Schedule
*
* Description: Provides scheduling mechanics including creating a schedule, testing if a specific moment is part of the schedule, moving back
@jwhulette
jwhulette / aws_cloud_watch_laravel_log.txt
Last active July 25, 2021 23:04
[Cloudwatch Multiline] #aws
multi_line_start_pattern = {datetime_format}
@jwhulette
jwhulette / vhost.ApacheConf
Last active April 2, 2018 18:03
[Apache Vhost] #apache
DocumentRoot /usr/local/www/apache24/data/public
ServerName vagrant.local
AccessFileName .htaccess-dev
DirectoryIndex /index.php index.php
# Defining a worker will improve performance
# And in this case, re-use the worker (dependent on support from the fcgi application)
# If you have enough idle workers, this would only improve the performance marginally
<Proxy "fcgi://localhost:9000/" enablereuse=on max=10>
</Proxy>