Skip to content

Instantly share code, notes, and snippets.

@andrewmcodes
Created November 22, 2023 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewmcodes/cda0f307bc1628000b20620e0e3327f0 to your computer and use it in GitHub Desktop.
Save andrewmcodes/cda0f307bc1628000b20620e0e3327f0 to your computer and use it in GitHub Desktop.
Add comment to random Ruby file
#! /usr/bin/env zsh
file=$(fd -e rb -H -1 | shuf -n 1)
line=$(shuf -i 1-$(($(wc -l < "$file") + 1)) -n 1)
awk -v line="$line" 'NR==line{$0="# GOOD_JOB: YOU PROBABLY FORGOT TO REMOVE THIS COMMENT DIDNT YOU\n"$0}1' "$file" > temp && mv temp "$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment