Skip to content

Instantly share code, notes, and snippets.

View kategray's full-sized avatar

Kate Gray kategray

  • CoreCodec, Inc.
View GitHub Profile
@kategray
kategray / notes.md
Created April 24, 2019 16:30
Interview notes

Tools

Starting script

DOMAIN='codebykate.com'
HOST='codebykate.com'
PROTO='https'
APP_PATH='/'
IP=`dig +short ${HOST}`
@kategray
kategray / pwcheck.php
Created October 5, 2020 03:26
Check a password against pwncheck in PHP.
<?php
#!/usr/bin/env php
$password = 'password';
$hash = sha1($password);
$truncated = substr ($hash, 0, 5); // First 5 characters
$checkValue = substr ($hash, 5); // Rest of the characters
$url = sprintf ('https://api.pwnedpasswords.com/range/%s', $truncated);
echo (sprintf ("Getting hashes from URL %s.\n", $url));
@kategray
kategray / createmrz.php
Created October 13, 2020 11:05
Create a MRZ for ID cards
#!/usr/bin/env php
<?php
// Line 1
$document_number = rand (0, 1000000000); // 9 Digits
$country = 'XXX'; // Unspecified
$document_type = 'I'; // ID Card
$document_subtype = '<'; // Generally 'D', or '<' for ID
$line1_optional = 'COMPANY'; // Optional, 15 chars
@kategray
kategray / .zshrc
Last active April 12, 2024 09:27
M1 dual homebrew (x86_64 and arm64) setup
#
# .zshrc for Mac M1 chips to handle both x86_64 and arm64 homebrew
#
# Be sure to remove .zprofile in order to prevent invalid paths, and
# remove /usr/local/bin from /etc/paths.
#
# Install both arch homebrew versions with:
# arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# arch -arm64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
@kategray
kategray / convert.ps1
Last active April 9, 2021 23:44
Convert a cisco PKCS12 (PEM/text format) to a binary P12 for OpenSSL
#
# Opens up keypair.txt and writes to keypair.p12
#
# Skip the first and last lines, and trim any whitespace
$text = (Get-Content keypair.txt | Select-Object -skip 1 | Select-Object -skiplast 1).Trim()
# Convert from Base64 to Bytes
$bytes = [System.Convert]::FromBase64String($text)
@kategray
kategray / build_universal.sh
Created April 13, 2021 15:21
Build universal (x86_64 + arm64) x264 libraries on an intel x86 Mac
#!/bin/bash
#
# build-universal.sh
#
# Compile a universal x264 binary on OS X (intel).
#
# Requires nasm. Install with homebrew: 'brew install nasm'
#
CONFIGURE_OPTS='--enable-shared --enable-static'