Skip to content

Instantly share code, notes, and snippets.

@johnsmclay
johnsmclay / 0-How-To.md
Last active July 9, 2024 19:46
Stream encrypting/decrypting along with gzipping, etc. originally for database dumps

When backing up databases/table to files I needed to have them encrypted for security and compliance. But there were a few concerns:

  1. I didn't want the file to be in plaintext, ever.
  2. I didn't want that same user to be able to decrypt the file later in case the account was compromised.

So, Pub/Priv is great for #2. Unfortunately, Pub/Priv is not made for large files, therefor I decided follow this process:

  1. Generate symetric key
  2. Encrypt files in-line w/ symetric key using AES-256-CBC
@sirthxalot
sirthxalot / Countries.php
Last active July 6, 2021 12:09
Country List for Laravel's Enum
<?php namespace App\Enums;
use BenSampo\Enum\Enum;
use BenSampo\Enum\Contracts\LocalizedEnum;
final class Countries extends Enum
{
const AF = "Afghanistan";
const AL = "Albania";
const DZ = "Algeria";
@mekya
mekya / custom_canvas.html
Last active February 14, 2022 09:54
Custom canvas streaming in Ant Media Server
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<style>