Skip to content

Instantly share code, notes, and snippets.

SELECT COUNT(1) FROM (
SELECT s_stats.id
FROM s_stats
LEFT JOIN s_organizations ON s_stats.organization_id = s_organizations.id
WHERE stats_purged_sents IS NULL
AND (
(
( ( s_organizations.permissions -> 'quota_mode' ) is not distinct from 'no_limit' )
OR
{"err":{"err":"InvalidSignatureException: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.\n\nThe Canonical String for this request should have been\n'POST\n/2015-03-31/functions/generator/invocations\n\nhost:lambda.us-east-1.amazonaws.com\nrequest-id:331dadb1-ca94-4702-aea4-a75814d7241e\nx-amz-content-sha256:052aad814a43f23b532a7a5e061a04c00509f286fc5ab0771df82ea9ebff1c65\nx-amz-date:20170228T231710Z\nx-client-send:1488323830067000\nx-parent:17\nx-span-id:0b085155-fe73-4732-83bc-f552f3ad7e27\n\nhost;request-id;x-amz-content-sha256;x-amz-date;x-client-send;x-parent;x-span-id\n052aad814a43f23b532a7a5e061a04c00509f286fc5ab0771df82ea9ebff1c65'\n\nThe String-to-Sign should have been\n'AWS4-HMAC-SHA256\n20170228T231710Z\n20170228/us-east-1/lambda/aws4_request\nbe82c8960dee68ea8f284bed241b6155ee59a2b7216d049446f3c4e2c064b2c4'\n\n at Object.extractError (/home/ubuntu/deployments/2017-0
@alexmchale
alexmchale / setup.sh
Last active November 4, 2016 14:12
Shell script to setup a session of bash per my preferences
# curl 'https://gist.githubusercontent.com/alexmchale/f04f3b3697f6e5c650adce44ba05fddc/raw/setup.sh' > /tmp/.atm.sh && source /tmp/.atm.sh
# SETUP STARTING
cat > /tmp/.atm.vim <<EOF
set nocompatible
set ch=1
set mousehide
⟪ alexmchale@argus ~/src/drh/crm-2 ⟫ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = git@github.com:drhinternet/greenarrow-stats.git
@alexmchale
alexmchale / logger.php
Created August 12, 2016 15:28
php script to log incoming requests
<?php
$message = "Received Request at " . time() . "\n";
$message .= "------------------------------------------------------------------------\n";
$message .= "\n";
$message .= json_encode($_REQUEST, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT) . "\n";
$message .= "\n";
$message .= json_encode($_SERVER, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT) . "\n";
$message .= "\n";
@alexmchale
alexmchale / README.md
Created July 7, 2016 15:35
suggested changes to inboxfirst campaign checks
--late-campaign-starting-warning MINUTES
Number of minutes a campaign has to start its sending process for WARNING, when the queue is not full (Default 3)

Current: 3; Recommend: No change

--late-campaign-starting-critical MINUTES
Number of minutes a campaign has to start its sending process for CRITICAL, when the queue is not full (Default 5)
@alexmchale
alexmchale / term_size.rb
Last active November 3, 2015 12:47 — forked from nixpulvis/term_size.rb
Get the terminal window size. Not in a bullshit ENV dependent manor.
# From the tty_ioctl man page in Linux.
#
# TIOCGWINSZ struct winsize *argp
# Get window size.
#
# TIOCSWINSZ const struct winsize *argp
# Set window size.
#
# The struct used by these ioctls is defined as
#
my $current_quota_allotment = 0;
my $current_quota_messages_key = undef;
my $current_quota_hourly_messages_key = undef;
my $current_quota_hour = undef;
my $return_organization_message_allotment = sub {
return if ( $current_quota_allotment <= 0 );
# Load the script if it's not already been read.
@alexmchale
alexmchale / alex_iced_coffee.markdown
Last active August 29, 2015 14:26
Alex's Iced Coffee
  1. Grind beans, semi-fine - enough for 3 scoops of Aeropress
  2. Add grounds to aeropress
  3. Stir in 175 degree water to the middle of the 4 on the aeropress for 30 seconds
  4. Slowly press into mug
  5. Add 2 tsp sugar, mix well
  6. Place in fridge or freezer until cold
  7. Add 1/4 cup of half-and-half, mix well
  8. Add giant ice cube
  9. Enjoy!
@alexmchale
alexmchale / gist:e91fd67df5ab829951db
Created March 2, 2015 14:37
Special Sending Rule - Skip Duplicates Per Day
# This special sending rule will prevent the same email address from receiving
# more than one email per day from campaigns that are configured to use this
# rule.
#
# It has no affect on:
#
# (1) campaigns that don't use this SSR
# (2) autoresponders.
# We want "today" to be in the "America/Chicago" time zone.