Skip to content

Instantly share code, notes, and snippets.


Neal Fennimore nealfennimore

View GitHub Profile
#! /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 VPN: NYU-NET Traffic Only"
- "NYU VPN: All Traffic"
nealfennimore /
Created Dec 22, 2020 — forked from m-radzikowski/
Minimal safe Bash script template - see the article with full description:
#!/usr/bin/env bash
set -Eeuo pipefail
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...]
View btree-depth.js
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 / xor-encryption-decryption.js
Last active Dec 28, 2019
XOR encryption and decryption
View xor-encryption-decryption.js
* 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 / diffie-hellman.txt
Created Dec 26, 2019
Diffie-Hellman Key Exchange
View diffie-hellman.txt
--- 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 / binary-addition.js
Last active Jul 6, 2020
Binary addition in javascript
View binary-addition.js
* 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 ) ];
View resume.json
"basics": {
"name": "Neal Fennimore",
"label": "Front-End Engineering Professional",
"picture": "",
"email": "",
"phone": "6093578917",
"website": "",
"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 /
Last active Feb 19, 2020
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 /
Created Nov 14, 2019
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
nealfennimore / wireguard.conf
Last active Apr 11, 2021
Wireguard VPN - Forward all traffic to server
View wireguard.conf
# ------------------------------------------------
# Config files are located in /etc/wireguard/wg0
# ------------------------------------------------
# ---------- Server Config ----------
Address = # IPV4 CIDR
Address = fd86:ea04:1111::1/64 # IPV6 CIDR
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Add forwarding when VPN is started
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i wg0 -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE # Remove forwarding when VPN is shutdown