Skip to content

Latest commit

 

History

History
116 lines (74 loc) · 4.22 KB

File metadata and controls

116 lines (74 loc) · 4.22 KB

Scripts

Dumb cute little scripts I've created over the last couple of years.

copper

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.

firefox-history-analysis

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.

pomodoro

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.

self-control

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).

zeitwerk-check

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.

git-dirs-exec

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.

files-sorted-by-last-commit

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

Setup

  1. Clone the repo
  2. Add repo root to your PATH or use scripts with ./scripts/script-name
  3. Make scripts executable: chmod +x ./scripts/script-name
  4. Install requirements for scripts you want to use

Referenced Tools

Self Control App

Timer

  • Install: brew install timer

RuboCop

  • Website
  • Install: Add to your Gemfile or gem install rubocop

Livebook

  • Website
  • Install: brew install livebook

fd

  • Source
  • Install: brew install fd

ag

  • Source
  • Install: brew install ag

Elixir, Ruby

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.