Skip to content

Instantly share code, notes, and snippets.

Soothsayer, Amulet, Sentry, Cellar, Page, Hireling, Margrave, Harbinger, Council Room, Wharf, Bandit Fort, Citadel, Travelling Fair, Tomb
@meatherly
meatherly / day3.md
Created December 3, 2021 23:08
Day 3

--- Day 3: Binary Diagnostic --- The submarine has been making some odd creaking noises, so you ask it to produce a diagnostic report just in case.

The diagnostic report (your puzzle input) consists of a list of binary numbers which, when decoded properly, can tell you many useful things about the conditions of the submarine. The first parameter to check is the power consumption.

You need to use the binary numbers in the diagnostic report to generate two new binary numbers (called the gamma rate and the epsilon rate). The power consumption can then be found by multiplying the gamma rate by the epsilon rate.

Each bit in the gamma rate can be determined by finding the most common bit in the corresponding position of all numbers in the diagnostic report. For example, given the following diagnostic report:

00100
@meatherly
meatherly / gist:a1a3fde9a0dfab82d13227d305df0ad3
Created August 11, 2023 14:59
NXP ls1028 Felix Ubuntu Router Setup
#!/bin/bash
#
# Simple switch configuration
#
# Assume both ENETC and Felix drivers are already loaded
#
BRIDGE=br0
MAC_ROOT=bc:8d:bf:7c:5b
@meatherly
meatherly / modify_spec_metadata.rb
Last active September 17, 2024 17:53
Rspec Metadata Modifier Script
#!/usr/bin/env ruby
require 'rspec'
require 'parser/current'
require 'unparser'
require 'optparse'
# This was generated by AI
# Install the required gems
# $ gem install parser unparser rspec