Skip to content

Instantly share code, notes, and snippets.

@turret-io
turret-io / aes_enc_dec.php
Last active September 4, 2023 00:10
AES encryption/decryption in PHP
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@turret-io
turret-io / slackNotify.js
Last active December 22, 2016 16:16
Parse SNS notification from Elastic Beanstalk and publish to Slack channel
var http = require('https');
// Create Slack channel -> Slack URL mapping
// This incoming webhook URL is provided when adding a Slack integration
var config = {
'#mychannel': 'https://hooks.slack.com/services/YOUR/SLACK/HOOK_HERE',
};
/*
Convenience method to fetch the channel's URL