Skip to content

Instantly share code, notes, and snippets.

View paulredmond's full-sized avatar
🏴‍☠️

Paul Redmond paulredmond

🏴‍☠️
View GitHub Profile
@paulredmond
paulredmond / docker.conf
Last active March 30, 2024 12:09
Example www pool for PHP-FPM with dynamic Environment variables
; if you're using the starter bundle file `docker/php/php-fpm.d/docker.conf`
[global]
daemonize = no
pid = run/php-fpm.pid
[www]
listen = /usr/local/var/run/php-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

System

uname -a     # Display Linux System Information
uname -r     # Display kernel release information
uptime       # Show how long the system has been running + load
hostname     # Show system host name
hostname -i  # Display the IP address of the host
last reboot  # Show system reboot history
date # Show the current date and time
function itemsSort(items) {
// Write your code here
const countObj = items.reduce((rlt, val) => {
if (val in rlt) {
rlt[val]++
} else {
rlt[val] = 1
}
return rlt;
}, {})
@paulredmond
paulredmond / ValidateMailgunWebhook.php
Created April 24, 2017 21:55
Laravel Middleware to Validate a signed Mailgun webhook
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Response;
/**
* Validate Mailgun Webhooks
* @see https://documentation.mailgun.com/user_manual.html#securing-webhooks
@paulredmond
paulredmond / HMACRequestHandler.php
Created April 7, 2017 05:43
Example Guzzle HTTP Middleware for a simple HMAC Authorization
<?php
namespace App;
use Carbon\Carbon;
use Psr\Http\Message\RequestInterface;
class HMACRequestHandler
{
private $key;
@paulredmond
paulredmond / remote-tail.js
Created May 18, 2011 23:15 — forked from justinrainbow/remote-tail.js
Tail a remote file on multiple servers with Node.js
var sys = require('sys'),
spawn = require('child_process').spawn,
// args from command line
filename, servers;
if (process.ARGV.length < 4) {
return sys.puts("Usage: node remote-tail.js filename server1 [serverN]");
}
@paulredmond
paulredmond / .zshrc
Last active July 12, 2021 17:22
Aliases to clear Laravel logs
# Must run from the root of a Laravel app
alias clearlog="truncate -s 0 $PWD/storage/logs/laravel.log"
alias clearlogs="truncate -s 0 $PWD/storage/logs/*.log"
# Or using git rev-parse
alias clearlog="truncate -s 0 $(git rev-parse --show-toplevel)/storage/logs/laravel.log"
alias clearlogs="truncate -s 0 $(git rev-parse --show-toplevel)/storage/logs/*.log"
@paulredmond
paulredmond / leanpub-tree-view.md
Created January 28, 2018 08:36
Docker for PHP Developers Leanpub Tree View
├── .gitignore
├── manuscript
│   ├── Book.txt
│   ├── Sample.txt
│   ├── Subset.txt
│   ├── acknowledgments.md
│   ├── backmatter.txt
│   ├── chapter01.md
│   ├── chapter02.md
@paulredmond
paulredmond / app.js
Last active September 26, 2020 15:03
Example Vue.js mixins for time
import dateMixin from './mixins/date';
// Globally
Vue.mixin(dateMixin);
@paulredmond
paulredmond / Caddyfile
Created October 12, 2017 03:57
The Caddyfile for a Laravel PHP project - https://caddyserver.com/docs/caddyfile
0.0.0.0
root /srv/app/public
gzip
fastcgi / 127.0.0.1:9000 php
rewrite {
regexp .*
ext /
to /index.php?{query}
}