Skip to content

Instantly share code, notes, and snippets.

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

Alister Bulman alister

🏠
Working from home
View GitHub Profile
@alister
alister / annual-prepay.md
Created August 9, 2017 16:23 — forked from patio11/annual-prepay.md
Appointment Reminder Annual Pre-pay copy (2014)

Notes

This is the latest version of an email which I send periodically, offering customers the opportunity to pre-pay for SaaS in return for a discount. The benefits to the SaaS company are better cash flow and reduced churn rate. The benefits to the customer are, well, in the email. This genre of email has produced hundreds of thousands of dollars in pre-pays for some companies I work with, and it rarely requires any more work than this example.

I've put $79 is as a placeholder for the cost of the user's plan. We calculate that for each account, naturally, along with the billing contact's name.

Subject: Save $79 on Appointment Reminder (and get a tax write-off) Formatting: 100% plain text. Gmail automatically links up the central link. From: Patrick McKenzie (Appointment Reminder) [email protected]

@alister
alister / MailgunWebhookSubscriber.php
Created July 31, 2017 12:05
Send message to a Slack channel (via another internal class) on MailgunEvent events
<?php
namespace App\Event;
use Azine\MailgunWebhooksBundle\Entity\MailgunEvent;
use Azine\MailgunWebhooksBundle\Entity\MailgunWebhookEvent;
use Ca\ProfileBundle\Services\SlackMessageable;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@alister
alister / DockerRedis_ExportImport_Dump.sh
Created January 27, 2015 21:46
Example of creating a Docker data volume, exporting it, and re-importing it to a completely fresh container
# Create the container - we run 'echo' in the container, and reuse the same as we will be running later
docker run -d -v /data --name redis.data dockerfile/redis echo Data-only container for Redis
# the data container doesn't show up - nothing is running
docker ps
# will show 'redis.data', but as stopped
docker ps -a
# start redis, attach to 'redis.data'
docker run -d -p 6379:6379 --volumes-from redis.data --name ca.redis.1 dockerfile/redis
-- File: abulman.co.uk.lua
-- Zone: abulman.co.uk
-- SOA record is automatically generated
-- Variable _a is replaced with zone name
-- _a = "abulman.co.uk" (from the filename)
-- _webserverIP & _longTTL are variables
-- A records -
std_a(_a, _webserverIP)
# Sample tinydns record
# These records are necessary for each domain to be properly delegate
# to Bytemark's four DNS servers. They insert the necessary NS records
# to claim authority for the domain.
# If you have delegated by name to the [abc].ns.bytemark.co.uk
# servers, use these lines
.abulman.co.uk::a.ns.bytemark.co.uk:259200
.abulman.co.uk::b.ns.bytemark.co.uk:259200
.abulman.co.uk::c.ns.bytemark.co.uk:259200
#
@alister
alister / Rakefile.deletebackups
Created March 29, 2012 10:52
A simple Rake task to delete backup files
# A simple Rake task to delete backup files
task :clean do
Dir['*~','**/*~'].each {|fn| rm fn rescue nil}
end
@alister
alister / runBeanstalkd-worker.sh
Created November 22, 2011 17:04
keep running cli-beanstalk-worker.php
#!/bin/bash
# runBeanstalkd-worker.sh
# a shell script that keeps looping until an exit code is given
# if it does an exit(0), restart after a second - or if it's a declared error
# if we've restarted in a planned fashion, we don't bother with any pause
# and for one particular code, exit the script entirely.
# The numbers 97, 98, 99 must match what is returned from the PHP script
#!/usr/bin/php
<?php
// cli-beanstalk-worker.php
// for testing of the BASH script
exit (rand(95, 100));
/* normally we would return one of
# 97 - planned pause/restart
# 98 - planned restart
# 99 - planned stop, exit.
#!/bin/sh
DIR=`readlink -f $0`
DIR=`dirname $DIR`
DIR=`readlink -f $DIR/..`
# ignoring the .svn subdirs, *.sh files, temp files or backups
# find files changed in the last day
FIND=`find $DIR/ -mtime 0 ! -name '*\.sh' ! -iname '\.bak'
! -iname '*~' -type f ! -name \.svn \
<?php
// bootstrap the DB access and configs...
// .....
$m = new ParseBounces();
require_once 'Zend/Mail/Storage/Maildir/Writeable.php';
try {
$mail = new Zend_Mail_Storage_Maildir_Writeable(
array('dirname' => $bounceMaildir)