Dumb cute little scripts I've created over the last couple of years.
- copper - Fix RuboCop violations automatically
- firefox-history-analysis - Analyze Firefox browsing habits
- pomodoro - Timer for focused work sessions
- self-control - Block distracting websites
- zeitwerk-check - Run Zeitwerk checks on Rails 6 projects
- files-sorted-by-last-commit - List files by last commit date
- git-dirs-exec - Run a command in each direct subfolder git repo
Ruby script that automates fixing RuboCop violations:
- Reads
.rubocop_todo.yml
, auto-fixes violations one by one, then creates commits/branches for each fix. - Requirements: Ruby, RuboCop, git
- Usage: Run
copper [max_number_of_commits]
in a Ruby project with a.rubocop_todo.yml
file.
Elixir script that shows your Firefox browsing habits:
- Shows most visited sites in a graphic chart and allows you to export it as CSV.
- Requirements: Elixir, Firefox browser, Livebook
- Usage: Open
firefox-history-analysis.livemd
in Livebook and run cells to analyze your Firefox history.
Shell script for running pomodoro:
- Runs a timer for focused work. Blocks distracting sites during work. Logs work sessions to daily notes. Plays sound when time's up.
- Note: This script relies on
self-control
script. Comment out that line if you don't want to use it. - Requirements: timer, self-control
- Usage: Run
pomodoro <duration> "<task_name>"
to start a focused work session.
Ruby script to block distracting websites:
- Blocks sites by categories (games, social, video). Edit the hardcoded hash of sites for your liking.
- Requirements: Ruby, SelfControl.app
- Usage: Run
self-control <duration> [category...]
to block sites (e.g.,./scripts/self-control 1h social video
).
At the time of writing I was working with bunch of ruby ~6 apps, maybe this would work with newer versions too? Try it, let me know. Bash script that runs Zeitwerk checks on Rails 6 projects:
- Finds all Rails 6 projects in subdirectories, then runs
zeitwerk:check
on each, then shows colored output for pass/fail. - Requirements: fd, ag, Ruby on Rails 6 apps that you want to fix. Needs to be called at your
repos/
folder or wherever your folder is for all the repos. - Usage: Run
zeitwerk-check
in a directory containing Rails projects.
Bash script to run a command in each direct subfolder git repo:
- Finds git repositories up to 2 levels deep and runs given command in each.
- Usage: Run
git-dirs-exec <command>
to execute command in all git repos.
Ruby script to sort files by their last commit date:
- Lists all Ruby files in git repo sorted by last commit date.
- Requirements: Ruby
- Usage example: Only list most recent ten:
files-sorted-by-last-commit | head -n10
- Clone the repo
- Add repo root to your PATH or use scripts with
./scripts/script-name
- Make scripts executable:
chmod +x ./scripts/script-name
- Install requirements for scripts you want to use
- Install:
brew install timer
- Website
- Install: Add to your Gemfile or
gem install rubocop
- Website
- Install:
brew install livebook
- Source
- Install:
brew install fd
- Source
- Install:
brew install ag
These are languages. If you don't care about the version managing, you can install them like this:
brew install ruby
brew install erlang elixir
But ideally you should know these languages. These scripts won't be much use to you if you don't know how to work with them.