Skip to content

Instantly share code, notes, and snippets.

View sc0ttdav3y's full-sized avatar

Scott Davey sc0ttdav3y

View GitHub Profile
@sc0ttdav3y
sc0ttdav3y / KillLongRunningQueries.sql
Last active March 2, 2020 15:49
Kill Slow Running MySQL Queries
--
-- Kills long running queries
--
-- @see https://stackoverflow.com/a/27293134
--
DROP PROCEDURE IF EXISTS `KillLongRunningQueries`;
SET GLOBAL event_scheduler = ON;
--
{
"$schemaTransformation" : "http://buzzword.org.uk/2008/jCard/transformation.js" ,
"id" : "jCard" ,
"version" : "0.1.0" ,
"title" : "jCard" ,
"description" : "This document defines the jCard data format for representing and exchanging a variety of information about an individual (e.g., formatted and structured name and delivery addresses, email address, multiple telephone numbers, photograph, logo, audio clips, etc.)." ,
"type" : "object" ,
"seeAlso" :
[
"http://microformats.org/wiki/jcard" ,
@sc0ttdav3y
sc0ttdav3y / _aws.graphql
Created May 7, 2021 01:36
AWS AppSync GraphQL scalars and directives to support type completion and error checking in Webstorm IDEs
# These are here to help the IDE recognise AWS types.
#
# Place this file outside the 'schema' directory so are not pushed to AWS,
# but are still picked up by PhpStorm's GraphQL plugin to help
# validate schemas.
#
# https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html
#
scalar AWSDateTime
scalar AWSDate
@sc0ttdav3y
sc0ttdav3y / OpenTelemetry.php
Last active January 4, 2024 08:53
OpenTelemetry + Bref + PHP + Lambda + Serverless
<?php
use OpenTelemetry\API\Common\Signal\Signals;
use OpenTelemetry\API\Trace\SpanInterface;
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\StatusCode;
use OpenTelemetry\API\Trace\TracerInterface;
use OpenTelemetry\Aws;
use OpenTelemetry\Aws\AwsSdkInstrumentation;
use OpenTelemetry\Aws\Lambda\Detector;
@sc0ttdav3y
sc0ttdav3y / CognitoSecureStorage.ts
Last active April 5, 2024 05:15
Cognito Secret Storage — implements token storage in a web worker to prevent inadvertent exposure
import {KeyValueStorageInterface, CookieStorage} from "aws-amplify/utils";
import {getLogger} from "../../util";
import {IAppInstance} from "../types";
import {SecureStorageEvent, SecureStorageMessage} from "../workers/cognitoSecureStorage";
const logger = getLogger("CognitoSecureStorage");
type SecureStorageCallback = (event: SecureStorageEvent) => void;
/**