{"id":15679159,"url":"https://github.com/vedang/bb-scripts","last_synced_at":"2025-07-29T16:05:02.894Z","repository":{"id":66954597,"uuid":"433923664","full_name":"vedang/bb-scripts","owner":"vedang","description":"A collection of Babashka scripts","archived":false,"fork":false,"pushed_at":"2025-01-02T17:03:20.000Z","size":28,"stargazers_count":11,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T09:15:26.897Z","etag":null,"topics":["babashka","clojure","scripting"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vedang.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-01T17:32:40.000Z","updated_at":"2025-01-02T17:03:24.000Z","dependencies_parsed_at":"2023-02-21T05:46:07.318Z","dependency_job_id":null,"html_url":"https://github.com/vedang/bb-scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedang%2Fbb-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedang%2Fbb-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedang%2Fbb-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vedang%2Fbb-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vedang","download_url":"https://codeload.github.com/vedang/bb-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252847523,"owners_count":21813458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babashka","clojure","scripting"],"created_at":"2024-10-03T16:26:32.599Z","updated_at":"2025-05-07T09:15:40.408Z","avatar_url":"https://github.com/vedang.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"A collection of useful scripts to run with [[https://babashka.org/][Babashka]]!\n\n* Table of Contents                                                     :TOC:\n- [[#bb-components][bb-components]]\n  - [[#pre-requisites][Pre-requisites]]\n  - [[#compiling-the-bb-components-script][Compiling the bb-components script]]\n  - [[#using-the-bb-components-script][Using the bb-components script]]\n- [[#bb-plain-text-tabs][bb-plain-text-tabs]]\n  - [[#pre-requisites-1][Pre-requisites]]\n  - [[#compiling-the-bb-plain-text-tabs-script][Compiling the bb-plain-text-tabs script]]\n  - [[#using-the-bb-plain-text-tabs-script][Using the bb-plain-text-tabs script]]\n\n* bb-components\n\nA script to find all the components that you should deploy your code to.\n\nIf a namespace contains a ~-main~ function in it, it represents an independently deployable 'component'. A monolith repo can have many such components. For any code change, this script quickly finds all the components affected by the change. This ensures that something is not accidentally missed in testing. It is also a great way to find your core namespaces and to identify areas requiring refactoring.\n\n#+begin_example\n  ✦ ➜ bb-components --help\n  List all the release components that you should deploy your code to.\n\n  Usage: bb-components [options] C1 C2\n\n  Options:\n    -e, --exclude-paths EXCLUDE-DIR  [\"test/\" \"qa/\"]  Directory to exclude in the search. Pass option multiple times to exclude multiple dirs.\n    -s, --source-paths SOURCE-DIR    [\"src/\"]         Directory where source files are stored. Pass option multiple times to include multiple dirs.\n    -t, --timeout TIMEOUT            60               Program times out in TIMEOUT seconds.\n    -v, --verbose                                     Prints out the actual files due to which a component is selected.\n        --stdin                                       Accept list of files from standard input. Ignore C1/C2 args in this case. List should be in the same format as generated by 'git diff --name-only'\n    -h, --help                                        Prints out this message.\n\n  C1 and C2 are Git SHAs / Refs / Tags representing the changed code.\n  The default value for C1 is HEAD and C2 is master\n  Examples:\n     bb-components                       # Calculate components for changes between HEAD and master\n     bb-components release-branch master # Calculate components for changes between release-branch and master\n     bb-components -t 60 -e test -e qa   # Changes between HEAD and master, but ignore changes in test/ and qa/ dirs. Abort if the run takes more than 60s.\n     bb-components -v                    # Print components as well as the specific files due to which the component was selected.\n     git diff a..b --name-only | bb-components --stdin # Calculate components impacted by files specified on STDIN\n#+end_example\n\n** Pre-requisites\n\n- Install Babashka: ~brew install borkdude/brew/babashka~\n- Install GNU-sed: ~brew install gnu-sed~\n\n** Compiling the bb-components script\n\nClone this repository, ~cd~ into it and run the following commands: (Note: If you are on a Linux machine, replace ~gsed~ with ~sed~ in the instructions)\n#+begin_src sh :eval no\n  # Create the target directory for building the compiled scripts\n  mkdir target\n  # Compile the components script\n  bb uberscript target/bb-components -m me.vedang.scripts.components\n  # Add a directive to tell the system that this is a bb script\n  gsed -i '1s/^/#!\\/usr\\/bin\\/env bb\\n/' target/bb-components\n  # Make the script executable\n  chmod a+x target/bb-components\n  # Copy the script somewhere on your $PATH, so that it can be used anywhere\n  cp target/bb-components /somewhere/in/PATH\n#+end_src\n\n** Using the bb-components script\n\nGo to your code repository and run ~bb-components --help~. Read through the output to see all the options the script accepts. The basic usage is to pass two points in git commit history to see what components are affected by the code changes. Example:\n#+begin_example\n➜ bb-components release-branch master\nComponents impacted by these code changes:\n\nwebsupport.service\njobs.runner\nwebhook.service\nwebsdk.core.service\napi.core.service\n#+end_example\n\nThe script also accepts filenames from stdin. This allows you to remove common files that might impact multiple components, but where you know that adding new data does not require deploying to all components. For example:\n#+begin_example\n➜ git diff 10.35.2 10.34.0 --name-only | rg -v \"(specs|audit_trail).clj$\" | bb-components --stdin -v -e src/migrators/\nNamespaces changed between these two points\n\nmodels.site\nmodels.blocking\nxhr.blocking\n\nComponents impacted by these code changes:\n\nwebsupport.service =\u003e impacted by changes in [models.site models.blocking xhr.blocking]\njobs.runner =\u003e impacted by changes in [models.site]\nwebhook.service =\u003e impacted by changes in [models.blocking]\n#+end_example\n\n* bb-plain-text-tabs\n\nA script to list all the open tabs in your browser and covert them to plain text in Org-Mode format.\n\nThis script uses TabFS to get information of all the open tabs from the browser. To install TabFS, please refer to https://omar.website/tabfs/#setup\"\n\nMy philosophy on reading / watching content in the browser is: Never read anything just because you have clicked on it.\n\nThe internet is full of interesting stuff that hijacks my attention. I end up getting completely distracted from my planned tasks. My solution to this is: I open all the links I want, but I don't read anything immediately. Instead, I capture the link in Org-Mode and schedule it for later (generally tomorrow). This way, when I am planning the day, I have a bunch of links in my Agenda. I choose which ones I want to read on any given day and defer / delete the rest. I use the excellent [[https://orgmode.org/manual/Agenda-Commands.html][Bulk Scatter]] tool built into Org Agenda for this.\n\nEarlier, I was capturing links manually, but now I have automated the task of collecting these links using this script.\n\n#+begin_example\n  ✦ ➜ bb-plain-text-tabs --help\n  Convert all open tabs to plain text Org Mode format. Optionally, close the open tabs.\n\n  Usage: bb-plain-text-tabs [options]\n\n  Options:\n    -fs,  --tabfs-mnt-path                *REQUIRED* TabFS mount path. The path on the filesystem where TabFS is mounted.\n    -hl,  --org-mode-heading-level        1                            The heading level at which link headings will be stored in Org Mode.\n    -s,   --scheduled-on           \u003cdate\u003e tomorrow                     Date on which to schedule reading this batch of links, in yyyy-MM-dd format.\n    -del, --delete-tabs            \u003cdel\u003e  false                        Boolean value to indicate if browser tabs should be closed\n\n  Examples:\n     bb-plain-text-tabs -fs \u003cTabFS Mount Path\u003e # Convert Open Tabs to Plain Text\n     bb-plain-text-tabs -fs \u003cTabFS Mount Path\u003e --delete-tabs # Delete tabs and print plain text\n     bb-plain-text-tabs -fs \u003cTabFS Mount Path\u003e | tee tabs.org # Capture Plain Text output to file\n#+end_example\n\n** Pre-requisites\n\n- Install Babashka: ~brew install borkdude/brew/babashka~\n- Install TabFS: https://omar.website/tabfs/#setup\n- Install GNU-sed: ~brew install gnu-sed~\n\n** Compiling the bb-plain-text-tabs script\n\nClone this repository, ~cd~ into it and run the following commands: (Note: If you are on a Linux machine, replace ~gsed~ with ~sed~ in the instructions)\n#+begin_src sh :eval no\n  # Create the target directory for building the compiled scripts\n  mkdir target\n  # Compile the components script\n  bb uberscript target/bb-plain-text-tabs -m me.vedang.scripts.tablist\n  # Add a directive to tell the system that this is a bb script\n  gsed -i '1s/^/#!\\/usr\\/bin\\/env bb\\n/' target/bb-plain-text-tabs\n  # Make the script executable\n  chmod a+x target/bb-plain-text-tabs\n  # Copy the script somewhere on your $PATH, so that it can be used anywhere\n  cp target/bb-plain-text-tabs /somewhere/in/PATH\n#+end_src\n\n** Using the bb-plain-text-tabs script\n\nRun ~bb-plain-text-tabs --help~. Read through the output to see all the options the script accepts.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvedang%2Fbb-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvedang%2Fbb-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvedang%2Fbb-scripts/lists"}