Skip to content

Instantly share code, notes, and snippets.

View nealfennimore's full-sized avatar
:shipit:
RGlkIHlvdSBhbHNvIGRlY29kZSB0aGlzPw==

Neal Fennimore nealfennimore

:shipit:
RGlkIHlvdSBhbHNvIGRlY29kZSB0aGlzPw==
View GitHub Profile
@nealfennimore
nealfennimore / hibernate.md
Last active July 26, 2022 04:00
PopOS BTRFS LUKS encrypted swap hibernation

Originally from: wmutschl/mutschler.eu#13 (comment)

  1. Create a LUKS partition for swap with the same password as cryptdata:
cryptsetup luksFormat /dev/nvme0n1p4

Ensure swap partition shows as linux-swap in gparted. If not, open gparted and decrypt the swap drive and then reformat as swap again.

@nealfennimore
nealfennimore / nyu_vpn_openconnect.sh
Last active April 27, 2022 16:54
NYU VPN Openconnect
#! /usr/bin/env bash
if [[ -z $NYU_AUTHGROUP || -z $NYU_NETID || -z $NYU_PASSWORD || -z $NYU_2FA ]]; then
cat << EOF
One or more env varibles missing
\$NYU_AUTHGROUP
- "NYU VPN: NYU-NET Traffic Only"
- "NYU VPN: All Traffic"
@nealfennimore
nealfennimore / script-template.sh
Created December 22, 2020 02:05 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@nealfennimore
nealfennimore / btree-depth.js
Created March 4, 2020 01:41
Binary Tree Depth
const getBTreeDepth = (tree) => {
const isEmpty = arr => arr.every(item => item === -1)
let nodes = 1;
let depth = 0;
let start = 0;
let end = 1;
while (nodes <= tree.length) {
@nealfennimore
nealfennimore / xor-encryption-decryption.js
Last active December 28, 2019 17:03
XOR encryption and decryption
/**
* Convert character string to binary
*
* @param {String} str Character string
* @returns Binary String
*/
function toBinary(str) {
let binary = '';
for (let i = 0, l = str.length; i < l; i++) {
binary += str.codePointAt(i).toString(2).padStart(8, '0');
@nealfennimore
nealfennimore / diffie-hellman.txt
Created December 26, 2019 23:49
Diffie-Hellman Key Exchange
--- Step 1 - exchanged common values
Initial common values:
p = 13 (prime number)
g = 7
--- Step 2 - Each user creates own secret number
Alice secret number:
a = 5
@nealfennimore
nealfennimore / binary-addition.js
Last active July 6, 2020 02:40
Binary addition in javascript
/**
* Add two bits together and get resulting bits
*
* @param {Number} a bit a
* @param {Number} b bit b
* @returns {Array<Number, Number>} Carry and sum as a result of addition
*/
function addBits(a, b){
return [ +( a && b ), +( a !== b ) ];
@nealfennimore
nealfennimore / resume.json
Last active May 14, 2020 01:02
Resume JSON
{
"basics": {
"name": "Neal Fennimore",
"label": "Front-End Engineering Professional",
"picture": "https://s.gravatar.com/avatar/fc8bb1dfce8f9841f9d153637fd16b38?s=200",
"email": "hi@neal.codes",
"phone": "6093578917",
"website": "https://neal.codes",
"summary": "Highly-analytical, innovative, and performance-driven, Front-End Engineering Professional with 8+ years of transferable experience and exposure in web development, programming languages, front-end development, JavaScript, ReactJS, strategic planning, data analysis, and cross-functional team collaboration. Possess a track record of accomplishment in managing multiple technical projects & initiatives, identifying discrepancies to create innovative solutions, facilitating continuous process improvements, and completing multiple technical projects in alignment with requirements.",
"location": {
@nealfennimore
nealfennimore / nextcloud.sh
Last active April 15, 2021 09:00
Nextcloud Snap Setup
# Setup firewall
sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
# Install nextcloud
sudo snap install nextcloud
# Update memory limit
sudo snap set nextcloud php.memory-limit=1024M
@nealfennimore
nealfennimore / checkit.sh
Created November 14, 2019 15:04
Git checkout to previous working commit
# We're currently on `non-working` branch, and we've identified a previous working commit of `abcdef123456`.
# We want to go back to commit `abcdef123456`, and then start work anew from there
# First checkout to the working commit `abcdef123456`
git checkout abcdef123456
# You'll be in a temporary staging area now. If we want to make changes now, we'll need to copy the current commit
# into a new branch.
git checkout -b previous-working-branch