Skip to content

Instantly share code, notes, and snippets.

View evansims's full-sized avatar

Evan Sims evansims

View GitHub Profile
@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.
View script.js
/**
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.
@evansims
evansims / decrypt.php
Last active August 30, 2023 05:05
AES-256-GCM w/ PHP 7.1+ OpenSSL
View decrypt.php
<?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 / Dockerfile
Last active February 14, 2024 10:09
Dockerfile: php-fpm 7.4-fpm alpine w/ gd bz2 intl mbstring redis mongodb xdebug opcache
View Dockerfile
FROM php:7.4-fpm-alpine
WORKDIR "/application"
# Install essential build tools
RUN apk add --no-cache \
git \
yarn \
autoconf \
g++ \
make \
@evansims
evansims / Octagon
Created April 21, 2019 21:33
Monokai Pro Slack Theme
View Octagon
#1E1F2B,#1E1F2B,#282A3A,#FFD76D,#1E1F2B,#9A9DA7,#95E18A,#F47777
@evansims
evansims / WilsonConfidenceIntervalCalculator.php
Created April 10, 2017 23:03 — forked from mbadolato/WilsonConfidenceIntervalCalculator.php
PHP translation of the Wilson ConfidenceInterval Calculator. Ported from Ruby and uses a hardcoded (pre-calculated) confidence (z value) instead of a dynamic calculation with a translation of Ruby's Statistics2.pnormaldist method. Since z doesn't change once it's computed, nor is the computation dependant on the passed-in values, calculating it …
View WilsonConfidenceIntervalCalculator.php
<?php
/*
* (c) Mark Badolato <mbadolato@gmail.com>
*
* This content is released under the {@link http://www.opensource.org/licenses/MIT MIT License.}
*/
namespace Bado\ScoreCalculator;
@evansims
evansims / gender_pronouns.js
Last active August 20, 2022 22:27
English Gender Pronouns JS/JSON
View gender_pronouns.js
gender: {
nominative: {
neutral: 'they',
masculine: 'he',
feminine: 'she',
elverson: 'ey',
spivak: 'E',
humanist: 'hu',
peh: 'peh',
per: 'per',
@evansims
evansims / gist:210f9a9bc7d42b0ad299
Created November 2, 2014 02:05
Re-encode a WAV to MP3 using ffmpeg, stripping metadata and reducing volume.
View gist:210f9a9bc7d42b0ad299
ffmpeg -i filename.wav -map_metadata -1 -vol 128 filename.mp3
@evansims
evansims / keybase.md
Last active August 29, 2015 14:05
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am evansims on github.
  • I am evansims (https://keybase.io/evansims) on keybase.
  • I have a public key whose fingerprint is 4F5E C6AC A591 2B02 65AC 2D7C B970 6FBE 74F6 A3EA

To claim this, I am signing this object:

@evansims
evansims / example.html
Last active February 5, 2024 16:52
Embedding or sharing a image or photo uploaded to Google Drive.
View example.html
<a href="https://drive.google.com/uc?export=view&id=XXX"><img src="https://drive.google.com/uc?export=view&id=XXX" style="width: 500px; max-width: 100%; height: auto" title="Click for the larger version." /></a>
@evansims
evansims / hooks.php
Last active May 20, 2020 19:27
An example of automatically including header and footer templates using Slim hooks.
View hooks.php
$app->hook('slim.before.dispatch', function () use ($app) {
$app->render('/views/header.php');
});
$app->hook('slim.after.dispatch', function () use ($app) {
$app->render('/views/footer.php');
});