Skip to content

Instantly share code, notes, and snippets.

View staticaland's full-sized avatar
🦜
Squawks the Parrot

Anders K. Pettersen staticaland

🦜
Squawks the Parrot
View GitHub Profile
@staticaland
staticaland / renovate-reading-list.md
Last active February 28, 2025 13:02
Renovate reading list

Renovate Reading List by Author

Jamie Tanna

  • Use Renovate
    • TL;DR: This article introduces Renovate, a tool that automates dependency updates in software projects. It explains how Renovate scans your repositories for outdated dependencies and creates pull requests to update them, ensuring your projects stay up-to-date with minimal manual intervention.
  • Renovate Global Defaults
    • TL;DR: This post delves into configuring global defaults in Renovate, allowing you to set standard behaviors across all your repositories. It covers how to define global settings for dependency updates, scheduling, and more, streamlining your project's maintenance.

Sebastian Poxhofer (secustor)

@staticaland
staticaland / gptel.md
Last active February 2, 2025 23:52
How gptel works

Under the Hood: How gptel Manages LLM Conversations in Emacs

If you've used Emacs to interact with LLMs, you've probably encountered gptel. While it appears simple on the surface—just another chat interface—its internals reveal an elegant approach to managing LLM conversations that leverages Emacs' text property system. Let's dive into how it works.

Visual vs Actual: The Prefix Illusion

One of the first things you notice in a gptel chat buffer are the prefixes—typically "### " for user messages in Markdown mode or "*** " in Org mode. What's interesting is that these prefixes are purely cosmetic. They're stripped out before any API calls using a simple but effective mechanism:

(defsubst gptel--trim-prefixes (s)
@staticaland
staticaland / golden.py
Last active October 14, 2024 11:47
This script generates a series of hash banners based on the golden ratio, making each line progressively shorter to fit within the aesthetic proportions of the golden ratio.
def golden_ratio_banner(depth, max_length):
# Golden ratio value
phi = (1 + 5**0.5) / 2
# Calculate and print each level based on the golden ratio
for i in range(depth):
length = round(max_length / (phi**i))
print("#" * length)

Different kinds of stickiness related to ALBs and target groups

  1. Target Group Target Stickiness (TargetGroup_TargetStickiness): Configured under a Target Group, this type of stickiness ensures that a client's requests are consistently routed to the same target (such as an EC2 instance or container) within that target group.

  2. Listener Rule Target Group Stickiness (ListenerRule_TargetGroupStickiness): Configured under a Listener Rule, this stickiness ensures that a client's requests are consistently routed to the same target group when multiple target groups are associated with that listener rule.

Let's delve into when it makes sense to use each:


type Cache struct {
Completions []string
Timestamp time.Time
}
const cacheFile = "completions_cache.gob"
const cacheExpiration = 1 * time.Hour
func addTabCompletionApp(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellCompDirective) {
cache, err := loadCache()

Managing state discrepancies: No-op vs. active changes during Terraform import for AWS Resources

TL;DR

For the enable_global_write_forwarding attribute in Terraform-managed AWS RDS clusters, setting it to false results in a state-only update with no AWS API call, effectively a no-op. Setting it to true triggers an actual API call to AWS to enable the feature.

Hypothesis

  1. State Tracking:
    • Terraform tracks the state of resources both in its state file and in AWS.
@staticaland
staticaland / terraform_import_enable_global_write_forwarding.md
Created May 28, 2024 08:50
terraform_import_enable_global_write_forwarding

When importing a resource into Terraform, certain parameters might not cause any changes in the actual AWS API calls, which can lead to confusion.

Parameter State Handling

  1. Terraform Parameter Tracking:

    • Terraform tracks the parameters within its state file.
    • When you set a parameter like enable_global_write_forwarding = false in Terraform, it does not necessarily result in an API call to AWS. Instead, it updates Terraform's state.
  2. AWS Parameter Representation:

  • In AWS, parameters like enable_global_write_forwarding might not have a direct equivalent for false. If this parameter is set to false in Terraform, AWS might not register any change because the parameter doesn't get included in the API call.