Skip to content

Instantly share code, notes, and snippets.

View rhelsing's full-sized avatar

Ryan Helsing rhelsing

View GitHub Profile
@rhelsing
rhelsing / rails_exercise.rb
Last active December 22, 2023 09:44
rails exercise
# Background:
# The following code works but I have intentionally introduced issues to make it inefficient.
# UserEvents are created for every interaction a user has in the system. It stores what employer, partner and
# controller they were on. When there were 10 users and only a little bit of traffic, this would run quickly.
# But now with 10,000 users and months of traffic - (millions of user events), this code would be very inefficient.
# Instructions:
# 1. Please make this code more efficient through refactoring so that it can run at a greater scale,
# along with adding some comments to improve the readability.
# 2. Please explain what the variable 'distinct_groups' will contain by the end of the execution and what
@rhelsing
rhelsing / clean_up_boot.sh
Created April 4, 2017 11:25 — forked from lloeki/clean_up_boot.sh
Clean up /boot of unused Ubuntu (and Debian?) kernels
# Ubuntu has a stupid policy of not cleaning up boots because they deem
# unknowable whether a kernel is valid or not (even if booted). Combined with
# the default Ubuntu setup that creates a ridiculously small /boot that is
# bound to be filled in a few months worth of updates, you have a recipe for a
# failure during upgrade, leading to being unable to update or remove anything
# and having to mess with apt and dpkg innards by hand.
# This may work for Debian too.
# This one liner keeps /boot fresh and clean by removing the currently
# running kernel version as well as the latest one (which may not be