1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-16 21:48:02 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
jbranchaud
6ff8f19d08 Add OpenStruct Has Bad Performance Characteristics as a Ruby TIL 2025-02-17 15:32:15 -06:00
jbranchaud
14e6635383 Add Fix Shim Path After asdf Upgrade as a Unix TIL 2025-02-17 10:31:58 -06:00
jbranchaud
0a0a509827 Link to groff in latest TIL 2025-02-17 09:52:06 -06:00
jbranchaud
bb331577ca Collapse Amplify category into the AWS category 2025-02-17 09:46:02 -06:00
jbranchaud
0e0dcbf2b4 Add AWS CLI Requires Groff Executable as an AWS TIL 2025-02-17 09:44:27 -06:00
5 changed files with 105 additions and 5 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1590 TILs and counting..._
_1593 TILs and counting..._
See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -24,6 +24,7 @@ See some of the other learning resources I work on:
* [Amplify](#amplify)
* [Ansible](#ansible)
* [Astro](#astro)
* [AWS](#aws)
* [Brew](#brew)
* [Chrome](#chrome)
* [Clojure](#clojure)
@@ -97,10 +98,6 @@ See some of the other learning resources I work on:
- [Case-Insensitive Search](ack/case-insensitive-search.md)
- [List Available File Types](ack/list-available-file-types.md)
### Amplify
- [Sign Up User With Email And Password](amplify/sign-up-user-with-email-and-password.md)
### Ansible
- [Loop Over A List Of Dictionaries](ansible/loop-over-a-list-of-dictionaries.md)
@@ -110,6 +107,11 @@ See some of the other learning resources I work on:
- [Generate Types For A Content Collection](astro/generate-types-for-a-content-collection.md)
- [Markdown Files Are Of Type MarkdownInstance](astro/markdown-files-are-of-type-markdown-instance.md)
### AWS
- [AWS CLI Requires Groff Executable](aws/aws-cli-requires-groff-executable.md)
- [Sign Up User With Email And Password](aws/sign-up-user-with-email-and-password.md)
### Brew
- [Configure Brew Environment Variables](brew/configure-brew-environment-variables.md)
@@ -1317,6 +1319,7 @@ See some of the other learning resources I work on:
- [Named Regex Captures Are Assigned To Variables](ruby/named-regex-captures-are-assigned-to-variables.md)
- [Navigate Back In The Browser With Capybara](ruby/navigate-back-in-the-browser-with-capybara.md)
- [Next And Previous Floats](ruby/next-and-previous-floats.md)
- [OpenStruct Has Bad Performance Characteristics](ruby/open-struct-has-bad-performance-characteristics.md)
- [Or Operator Precedence](ruby/or-operator-precedence.md)
- [Output Bytecode For A Ruby Program](ruby/output-bytecode-for-a-ruby-program.md)
- [Override The Initial Sequence Value](ruby/override-the-initial-sequence-value.md)
@@ -1529,6 +1532,7 @@ See some of the other learning resources I work on:
- [Find Newer Files](unix/find-newer-files.md)
- [Find Occurrences Of Multiple Values With Ripgrep](unix/find-occurrences-of-multiple-values-with-ripgrep.md)
- [Find Top-Level Directories Matching A Pattern](unix/find-top-level-directories-matching-a-pattern.md)
- [Fix Shim Path After asdf Upgrade](unix/fix-shim-path-after-asdf-upgrade.md)
- [Fix Unlinked Node Binaries With asdf](unix/fix-unlinked-node-binaries-with-asdf.md)
- [Forward Multiple Ports Over SSH](unix/forward-multiple-ports-over-ssh.md)
- [Generate A SAML Key And Certificate Pair](unix/generate-a-saml-key-and-certificate-pair.md)

View File

@@ -0,0 +1,30 @@
# AWS CLI Requires Groff Executable
I have the AWS CLI installed on this machine, but when I went to run certain
commands like `aws logs tail my_log_group` or even `aws logs tail help`, I'd
get the following error:
```
$ aws logs tail help
Could not find executable named 'groff'
```
This may only be an issue on MacOS Ventura for older versions of the CLI, per
[this PR](https://github.com/aws/aws-cli/pull/7413):
> The CLI's help commands are currently broken on macOS Ventura because Ventura has replaced groff with mandoc. This PR fixes the issue by falling back on mandoc if groff doesn't exist in the path.
There are two ways of dealing with this. One would be to install the missing
dependency, [`groff`](https://www.gnu.org/software/groff/):
```bash
$ brew install groff
```
The other is to update the AWS CLI to one that falls back to `mandoc`.
Depending on how you originally installed the AWS CLI, you can either [follow
their official install/upgrade
instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html),
`pip install --upgrade awscli`, or upgrade view homebrew (`brew upgrade
awscli`).

View File

@@ -0,0 +1,32 @@
# OpenStruct Has Bad Performance Characteristics
The Ruby docs for `OpenStruct` have a [_Caveats_
section](https://ruby-doc.org/3.4.1/stdlibs/ostruct/OpenStruct.html#class-OpenStruct-label-Caveats)
that warns about the poor performance characteristics of `OpenStruct` relative
to `Struct` and `Hash`.
> This should be a consideration if there is a concern about the performance of
> the objects that are created, as there is much more overhead in the setting
> of these properties compared to using a Hash or a Struct. Creating an open
> struct from a small Hash and accessing a few of the entries can be 200 times
> slower than accessing the hash directly.
This doesn't mean don't use `OpenStruct`, but do be aware of if you are using
it in a hot path or if you are allocating and processing tons of them.
If you turn on _Performance Warnings_ in Ruby, you'll see a warning message
when allocating an `OpenStruct`.
```ruby
> require 'ostruct'
=> true
> os1 = OpenStruct.new
=> #<OpenStruct>
> Warning[:performance] = true
=> true
> os2 = OpenStruct.new
(irb):6: warning: OpenStruct use is discouraged for performance reasons
=> #<OpenStruct>
```
[source](https://www.reddit.com/r/ruby/comments/1d54mwl/comment/l6jgn59/)

View File

@@ -0,0 +1,34 @@
# Fix Shim Path After asdf Upgrade
While doing [`brew install groff`](aws/aws-cli-requires-groff-executable.md),
Homebrew decided to upgrade every last thing it knows about on my machine,
including `asdf`.
`asdf` has undergone some big recent changes, including [a rewrite in
Go](https://stratus3d.com/blog/2025/02/03/asdf-has-been-rewritten-in-go/).
I noticed that `asdf` wasn't picking up my specified tool versions. I tried an
`asdf reshim`, but that didn't do the trick. Someone else wrote that [asdf
seems broken after homebrew
upgrade](https://braytonium.com/2023/01/09/asdf-seems-broken-after-homebrew-upgrade/)
which gave some hints and pointed me to some interesting GitHub issues.
Additionally, I noticed when opening a fresh terminal session the following error from `zsh`:
```bash
/Users/jbranchaud/.zshrc:.:225: no such file or directory: /usr/local/opt/asdf/libexec/asdf.sh
```
That directory and file is gone. So, how does `asdf` now want you to configure
its path with `zsh`? Revisiting their updated docs, I can see that the instead
of sourcing that shell script, we should now export shims to the path:
```bash
# . /usr/local/opt/asdf/libexec/asdf.sh
export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
```
Updating my `.zshrc` to the above and then reloading did the trick. My tool
versions are registering now.
[source](https://asdf-vm.com/guide/getting-started.html#_2-configure-asdf)