1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-07 09:08:01 +00:00

Compare commits

...

5 Commits

Author SHA1 Message Date
nick-w-nick
68f2f76fa0 Merge 295fe153ad into ee31f5b70d 2025-02-19 15:34:52 -05:00
jbranchaud
ee31f5b70d Add Find And Follow Server Logs as an AWS TIL 2025-02-19 09:00:35 -06:00
jbranchaud
5b6a88b327 Remove the amplify TOC item, no longer exists 2025-02-19 09:00:11 -06:00
jbranchaud
49ebb8dd78 Add A Better Way To Reload ZSH Configuration as a ZSH TIL 2025-02-18 17:06:35 -06:00
nick-w-nick
295fe153ad added mention of ES6 compatibility
Hello, I've added a small blockquote below the description to indicate that this method of accessing an indefinite number of function arguments has been superseded by the use of the spread operator via rest parameters for ES6+ compatibility.
2022-01-06 11:39:04 -05:00
4 changed files with 86 additions and 2 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).
_1593 TILs and counting..._
_1595 TILs and counting..._
See some of the other learning resources I work on:
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
@@ -21,7 +21,6 @@ See some of the other learning resources I work on:
### Categories
* [Ack](#ack)
* [Amplify](#amplify)
* [Ansible](#ansible)
* [Astro](#astro)
* [AWS](#aws)
@@ -110,6 +109,7 @@ See some of the other learning resources I work on:
### AWS
- [AWS CLI Requires Groff Executable](aws/aws-cli-requires-groff-executable.md)
- [Find And Follow Server Logs](aws/find-and-follow-server-logs.md)
- [Sign Up User With Email And Password](aws/sign-up-user-with-email-and-password.md)
### Brew
@@ -1884,6 +1884,7 @@ See some of the other learning resources I work on:
### Zsh
- [A Better Way To Reload ZSH Configuration](zsh/a-better-way-to-reload-zsh-configuration.md)
- [Add To The Path Via Path Array](zsh/add-to-the-path-via-path-array.md)
- [Link A Scalar To An Array](zsh/link-a-scalar-to-an-array.md)
- [Use A Space To Exclude Command From History](zsh/use-a-space-to-exclude-command-from-history.md)

View File

@@ -0,0 +1,46 @@
# Find And Follow Server Logs
Let's say you are authenticated with the AWS CLI and have the appropriate
CloudWatch permissions. You have a few services running in production with
associated logs. One of those is a Rails server.
We want to run `aws logs tail`, but first we check how that command works.
```bash
$ aws logs tail help
```
We see a bunch of options, but the only required one is `group_name` ("The name
of the CloudWatch Logs group."). We may also notice the `--follow` flag which
we'll want to use as well to keep incoming logs flowing.
We need to determine the log group name for the Rails server. We can do that
from the CLI as well (no need to dig into the web UI).
```bash
$ aws logs describe-log-groups
{
"logGroups": [
{
"logGroupName": "/aws/codebuild/fc-rails-app-abcefg-123456",
"creationTime": 1739476650823,
"metricFilterCount": 0,
"arn": "arn:aws:logs:us-east-2:123456789:log-group:/aws/codebuild/fc-rails-app-abcefg-123456:*",
"storedBytes": 65617,
"logGroupClass": "STANDARD",
"logGroupArn": "arn:aws:logs:us-east-2:123456789:log-group:/aws/codebuild/fc-rails-app-abcefg-123456"
},
...
]
}
```
Because the group name is descriptive enough, we can find the log group we are
interested in: `/aws/codebuild/fc-rails-app-abcefg-123456`.
Now we know what we want to `tail`.
```bash
$ aws logs tail /aws/codebuild/fc-rails-app-abcefg-123456 --follow
```

View File

@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
all of the arguments are referenced in the function signature, they can
still be accessed via the `arguments` object.
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
```javascript
function argTest(one) {
console.log(one);

View File

@@ -0,0 +1,35 @@
# A Better Way To Reload ZSH Configuration
I have an alias in my `~/.zshrc` that I set up to make it easy to "reload" my
ZSH configuration. This is handy if I'm iterating on some changes to my
`~/.zshrc` file and need verify them as I go.
```bash
alias reload='source ~/.zshrc'
```
With this alias, I can call `reload` from the terminal and the latest version
of my configuration (according to the `~/.zshrc` file) will be loaded for that
shell instance.
This has some downsides. It doesn't account for the other kinds of files that
contribute to your shell configuration (e.g. `~/.zprofile`) and it can lead to
duplicate values in your `PATH` and init scripts being run an additional time.
A better way is to use:
```bash
$ omz reload
```
This is [a wrapper call around `exec
zsh`](https://github.com/ohmyzsh/ohmyzsh/blob/master/lib/cli.zsh#L669-L677),
which restarts the `zsh` process. It also clears the completion cache.
I've since updated my `~/.zshrc` alias for `reload`:
```bash
alias reload='omz reload'
```
[source](https://batsov.com/articles/2022/09/15/reload-zsh-configuration/)