Skip to content

Instantly share code, notes, and snippets.

View MPJHorner's full-sized avatar
👨‍💻
Focusing

Matt Horner MPJHorner

👨‍💻
Focusing
View GitHub Profile
docker rm $(docker ps -qa --no-trunc --filter "status=exited")
Or to force...
docker rm -f $(docker ps -qa --no-trunc --filter "status=exited")
@MPJHorner
MPJHorner / index.js
Last active December 16, 2021 10:43
SES Tracking Lambda To Mysql
const mysql = require('mysql2');
// const pool = mysql.createConnection({
// host: process.env.MYSQL_HOST,
// user: process.env.MYSQL_USER,
// password: process.env.MYSQL_PASSWORD,
// database: process.env.MYSQL_DB,
// });
const pool = mysql.createPool({
@MPJHorner
MPJHorner / index.js
Created July 2, 2021 13:02
Amazon SES Suppression to CSV and Removal Tool (HACKY AF)
// Pleas excuse how messy and hacky AF this is... It works though.
// Please ensure you have local auth setup to AWS CLI already, otherwise you made need to modify the config bits to include some auth...
// import { SESv2Client, ListSuppressedDestinationsCommand } from "@aws-sdk/client-sesv2"; // ES Modules import
const { SESv2Client, ListSuppressedDestinationsCommand, DeleteSuppressedDestinationCommand } = require("@aws-sdk/client-sesv2"); // CommonJS import
const converter = require('json-2-csv');
const fs = require('fs');
const config = {};
const save = true; //Set to FALSE to stop saving results to CSV
@MPJHorner
MPJHorner / readme.md
Created June 1, 2021 14:52
PHP Switcher - via Brew (Excluding Apache / Nginx)

Add above file (script.sh) to /usr/local/bin/sphp Then run chmod +x /usr/local/bin/sphp

@MPJHorner
MPJHorner / Ubuntu16SwapFile
Created September 5, 2016 17:10
Create Swap File on Ubuntu 16.04
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo swapon --show
@MPJHorner
MPJHorner / aws-cloudwatch-logs.js
Created May 14, 2020 08:16
AWS NodeJS Lambda SES SNS Cloudwatch - Tracking Open, Sends & Deliveries
module.exports = function (config) {
var cloudwatchlogs = config.cloudwatchlogs,
logGroupName = config.logGroupName || '/aws-cloudwatch-logs/default';
return {
log: function (eventName, message, done) {
var logCallback = done || function () {},
@MPJHorner
MPJHorner / index.js
Last active May 14, 2020 08:12
Amazon SES NodeJS Test Script /w Configuration Set
var ses = require('node-ses')
var client = ses.createClient({
key: '%AWS_KEY_HERE%',
secret: '%AWS_SECRET_HERE%',
amazon: 'https://email.eu-west-2.amazonaws.com'
});
// Give SES the details and let it construct the message for you.
client.sendEmail({
to: 'other@rea.com',
@MPJHorner
MPJHorner / config.yml
Created April 27, 2020 16:46 — forked from thijskok/config.yml
CircleCI 2.0 Laravel build configuration with PHP 7.1, NodeJS, and MySQL support. Runs both PHPunit as well as Laravel Dusk. Proper GD configuration for image editing purposes. Several linters included (requires including them in composer / package.json).
version: 2
jobs:
build:
working_directory: ~/user/repo
environment:
BASH_ENV: ~/.bashrc
docker:
@MPJHorner
MPJHorner / config.yml
Created April 27, 2020 16:46 — forked from thijskok/config.yml
CircleCI 2.0 Laravel build configuration with PHP 7.1, NodeJS, and MySQL support. Runs both PHPunit as well as Laravel Dusk. Proper GD configuration for image editing purposes. Several linters included (requires including them in composer / package.json).
version: 2
jobs:
build:
working_directory: ~/user/repo
environment:
BASH_ENV: ~/.bashrc
docker:
@MPJHorner
MPJHorner / ListAllPhpTimezoneLocations.php
Created March 24, 2020 09:17
PHP - List All Timezone Locations
<?php
$timezones = timezone_identifiers_list();
foreach ($timezones as $tz){
echo $tz . PHP_EOL;
}