Skip to content

Instantly share code, notes, and snippets.

@AndyBold
AndyBold / JQ: Selecting items the do not have a certain key set.txt
Created April 22, 2021 12:48
It's easy to select items that have (or do not have) values set for keys. How do you select items that do not have a certain key set?
Example: I want to list EIP details for all EIPs that do not have any associations. I.e., they are unused.
```shell
aws ec2 describe-addresses --region us-west-2 | jq '.Addresses[] | select( has("AssociationId") == false)'
```
git config --global alias.wip "for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads"
# Then
git wip
Source: https://carolynvanslyck.com/blog/2020/12/git-wip/
@AndyBold
AndyBold / Filebeats dissect for ALB logs.json
Created March 17, 2021 09:55
I use this with the sebp/elk Dockerised ELK stack, mounted as beats config.
filter {
dissect {
mapping => {
"message" => '%{protocol} %{timestamp} %{destination} %{ip_source} %{ip_destination} %{request_processing_time} %{backend_processing_time} %{response_processing_time} %{elb_status} %{backend_status} %{received_bytes} %{sent_bytes} "%{request}" "%{user_agent}" %{ssl_cipher} %{ssl_protocol} %{target_group_arn} "%{trace_id}" "%{domain_name}" "%{chosen_cert_arn}" %{matched_rule_priority} %{request_creation_time} "%{actions_executed}" "%{redirect_url}" "%{error_reason}" "%{target}" "%{target_status}" "{%classification}" "{classification_reason}"'
}
}
}
input {
beats {
@AndyBold
AndyBold / Git global alias to show repository root
Created March 15, 2021 17:29
A handy shortcut that let's you do things like `cd $(git root)` to get back to the root of the current repo being worked in.
git config --global alias.root 'rev-parse --show-toplevel'
# Then
git root
@AndyBold
AndyBold / keybase.md
Created April 15, 2015 06:58
Adding my keybase.io proof of ID

Keybase proof

I hereby claim:

  • I am AndyBold on github.
  • I am andybold (https://keybase.io/andybold) on keybase.
  • I have a public key whose fingerprint is CCB8 3A75 F9AC 9EF2 E05F 167D 8233 E16F B27E DAC1

To claim this, I am signing this object: