Skip to content

Instantly share code, notes, and snippets.

View johnsmclay's full-sized avatar

M. Clay Johns johnsmclay

View GitHub Profile

Keybase proof

I hereby claim:

  • I am johnsmclay on github.
  • I am johnsmc (https://keybase.io/johnsmc) on keybase.
  • I have a public key ASCr5gqsNS52_g5Je5qXT3s3gcR6v6i7-ANIZ2gNo2ydxQo

To claim this, I am signing this object:

@johnsmclay
johnsmclay / create_vlans.ps1
Last active April 10, 2024 11:07
How to get vLAN tagging support on windows 10, especially for Intel NICs
# Need to run this as Administrator
# To turn on Hyper-V if necessary, see:
# https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v
Import-Module Hyper-V
# A hashtable of NIC/vLAN names and vLAN IDs you want to create NICs for
$vlans=@{ "Main" = 1;
"Public" = 2;
"Public 2" = 3;
@johnsmclay
johnsmclay / basic_column_stats.sql
Last active February 4, 2016 18:13
Get basic statistical and variation info on every column in a table
DROP TABLE IF EXISTS `clay_sandbox`.`column_stats`;
CREATE TABLE `clay_sandbox`.`column_stats` (
`database` varchar(64) NOT NULL,
`table` varchar(64) NOT NULL,
`column` varchar(64) NOT NULL,
`position_in_table` bigint(20) SIGNED NOT NULL,
`nonnull_vals` bigint(20) DEFAULT NULL,
`nonmnull_pctg` decimal(7,5) DEFAULT NULL,
`sum_val` decimal(32,16) DEFAULT NULL,
`min_val` decimal(32,16) DEFAULT NULL,
@johnsmclay
johnsmclay / 0-How-To.md
Last active April 5, 2022 05:30
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