Skip to content

Instantly share code, notes, and snippets.

View evansims's full-sized avatar

Evan Sims evansims

View GitHub Profile
@evansims
evansims / Dockerfile
Last active September 16, 2024 07:08
Dockerfile: php-fpm 7.4-fpm alpine w/ gd bz2 intl mbstring redis mongodb xdebug opcache
FROM php:7.4-fpm-alpine
WORKDIR "/application"
# Install essential build tools
RUN apk add --no-cache \
git \
yarn \
autoconf \
g++ \
make \
@evansims
evansims / decrypt.php
Last active October 3, 2024 11:19
AES-256-GCM w/ PHP 7.1+ OpenSSL
<?php
public function decrypt($secret, $data)
{
$secret = hex2bin($secret);
$iv = base64_decode(substr($data, 0, 16), true);
$data = base64_decode(substr($data, 16), true);
$tag = substr($data, strlen($data) - 16);
$data = substr($data, 0, strlen($data) - 16);
try {
@evansims
evansims / script.js
Last active February 16, 2023 00:43
Google Apps Script: Sync Google Group members Out of Office events to a shared calendar, including recurring OOF events, using the outOfOffice eventType.
/**
This is based on the example provided at:
https://developers.google.com/apps-script/samples/automations/vacation-calendar
The following changes were made:
- Uses the outOfOffice eventType to identify events to sync. It does not use a keyword search.
- Events use the full names of members, pulled from the Google Workspace API (AdminDirectory.)
- Recurring OOF events are supported.
- Creates "shadow events" instead of importing the actual events, to circumvent "forbidden" errors in some cases, and issues with recurring events.