Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs');
const path = require('path');
const bigFile = path.join(__dirname, './stop_times.txt');
const fmtTime = timeArray => (timeArray[0] + timeArray[1] * .000000001).toPrecision(6);
const calcSecs = startTime => fmtTime(process.hrtime(startTime));
const begin = process.hrtime();
@acidDrain
acidDrain / Things_To_Learn.md
Last active December 5, 2017 15:51
Valuable/In-Demand Skills/Technology in 2017/2018

Skills to Learn

Below is a list of modern skills, tools, and technology being used in the InfoSec and Cloud fields. This list isn't meant to be 100% comprehensive, but does include the more in-demand/popular skills that are extremely valuable.

Programming

  • Python
  • JavaScript/node.js
  • Go
  • Shell scripting (i.e. bash/powershell)

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@acidDrain
acidDrain / kube-primitives.md
Created February 9, 2018 17:52
Kubernetes Primitives

Kubernetes Primitives

Pod - the deployment unit for a related collection of containers.

Service - service discovery and load balancing primitive.

Job - an atomic unit of work scheduled asynchronously.

CronJob - an atomic unit of work scheduled at a specific time in the future or periodically.

@acidDrain
acidDrain / bash_prompt.sh
Last active November 11, 2018 13:08
Bash prompt that includes current Kubernetes context and current git branch
parse_git_branch() {
git branch 2> /dev/null | grep "^\*" | sed -e 's/\(\* \)\(.*\)/\(\2\)/g'
}
export PS1="\[\e[97m\][\$(kubectl config current-context 2> /dev/null )]\[\e[39m\] \$USER@\$HOSTNAME:\[\e[38;5;226m\]\w\[\e[39m\]\[\e[96m\] \$(parse_git_branch)\[\e[0m\]$ "
@acidDrain
acidDrain / public.key
Created July 26, 2018 16:16
Public GPG Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFnkFDMBCAD8czBCrAyDQP2rZbmYBOJbUkrgPQuKz9cZHUaYj9tg2nfXddfz
Y7OyDBYW46iIMx/VwDkhUwvfGlGfJebLhYl2i3YYSSrsh1r3fMJ0mPO6uxdllD8g
hx1vw6yhQfXeK6SPuBl5vtDNrKI1WXQ3d2riD4LPDR/3gW5jWe2zK6LXZ7vz4hkA
DAHG3QVrJWox4A50zs24hClyJ7uF8iksNcNgLIbpZ/KsWbxVFhauoXHU2OiQkmlR
S1CdOResFzOVoddlmzJ83/w8g55wObv6paUXo07IBFV9KNberh4ZgGgzD0svb3FS
agwo9A4tmqK3prlA+M+W0uu8q5WxUcKmMsp5ABEBAAG0HUphbWVzIEdyb3cgPGpt
Z3Jvd0BnbWFpbC5jb20+iQFOBBMBCAA4FiEE4DM+i25hbYDfjvIazWi1APPCklMF
AlnkFDMCGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQzWi1APPCklMXdAgA
@acidDrain
acidDrain / amend_git_author.sh
Created October 26, 2018 14:46
Amend Git Author/History
git config user.name "username"
git config user.email "user-email@nowhere.lan"
git commit --amend --author="username <user-email@nowhere.lan>" --no-edit
git rebase -i <commit number>
# (re-order "commands" section of text file that opens)
# Force the commit to remote without merging
git push -f
@acidDrain
acidDrain / node_classifier.sh
Created October 31, 2018 04:46
Sample Puppet Node Classifier
#!/bin/bash
args=("$@")
# Get an array of arguments, and only use the first one (name of node to be classified)
NODE="${args[0]}"
# Node names starting with dev- get assigned the development environment
if grep -Piq "^dev-" <(echo $NODE)
then
echo "---"
echo "environment: development"
@acidDrain
acidDrain / combine_videos.sh
Last active January 28, 2019 07:21
Quick bash script that combines video files into a single file using ffmpeg
#!/usr/bin/env bash
# Exit immediately upon error, echo out commands as they're
# being run, etc.
set -euox pipefail
# Backup the old internal field separator environment variable
export OLDIFS=$IFS
# Change the internal field separator to the newline character
@acidDrain
acidDrain / get_caller_dir.sh
Created March 4, 2019 02:38
Get the directory script is called from
#!/usr/bin/env bash
# Exit immediately on errors
set -e
# Get directory called script is located in
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"