Skip to content

Instantly share code, notes, and snippets.

View driskell's full-sized avatar

Jason Woods driskell

View GitHub Profile
@driskell
driskell / test-lazy-proxy-promise.php
Created October 22, 2026 12:36
Lazy AWS SDK PHP Symfony __get() guard conflict
<?php
/**
* Reproduces "Warning: Undefined property: LazySnsClient::$api" followed by
* "InvalidArgumentException: Operation not found: DeleteEndpoint" on PHP < 8.4.
*
* aws-sdk-php-symfony declares every client lazy, so Symfony wraps it in a LazyProxyTrait proxy. The first
* call made from a promise callback initialises the proxy inside its magic __isset/__get. Building the real
* client waits on a promise in ClientResolver, which drains Guzzle's global task queue and runs the other
* queued callbacks while that __get is still on the stack. Their __get('api') on the same proxy is skipped
@driskell
driskell / gist:c37d730bff4e1ecf740e0807184eac4f
Created August 17, 2026 07:09
Doris parse number fail, string: '-----2628' — root cause analysis & fix
Doris parse number fail, string: '-----2628' — root cause analysis & fix
Context
Inserting CloudFront logs from a Glue/Hive JSON external table into an OLAP unique-key table:
INSERT INTO internal.cloudfront.test
SELECT ..., IF(`sc-content-len` = "-", NULL, `sc-content-len`) AS `sc-content-len`
FROM aws_glue.`cloudfront-logs`.cloudfront WHERE ...;
<?php
/**
* Load a playlist's videos from the API, or return from the playlist if EXPLICIT
*
* @param \Drupal\brightcove\BrightcovePlaylistInterface<mixed> $entity
* @return array<\Drupal\brightcove\BrightcoveVideoInterface<mixed>>
*/
function load_brightcove_playlist_videos(\Drupal\brightcove\BrightcovePlaylistInterface $entity): array {
// Only perform API lookup for smart playlists - for others the display will render the explicitly linked videos
@driskell
driskell / setphp.sh
Last active November 29, 2020 11:51
Brew helper for switching php versions
# Requires ZSH
# Install your PHP versions via: brew install php@x.x
# Where x.x is the version such as 7.4
# Do not need to link them it's harmless
# Add the below to your .profile or something
# Then run setphp x.x when you need to change php version - it will update php version in all terminal sessions
# Add to PATH to prefer over any system installed
export PATH="$HOME/bin/php:$PATH"
@driskell
driskell / clean_magento_images.py
Last active November 29, 2020 11:51
Clean unused catalog images from the Magento 1 media folder. Run inside the media folder. Supports ability to scan attributes with custom backends.
# yum install mysql-connector-python
import ConfigParser
from contextlib import contextmanager
import getopt
import getpass
import io
from mysql.connector import connection
import os
import re