DEV Community

sarvsav
sarvsav

Posted on

Day003 - Random posts under TIL

Topics:

  1. Bookmarks manager
  2. Observability (from zero to hero)
  3. Cyphernetes
  4. Comment all entries in crontab
  5. starship

1. Bookmarks manager
Linkding - A self hosted bookmarks manager with minimal design and easy to setup using docker. If you are interested to design your own bookmarks manager, then there are tips by user I<3RMS on writing a good bookmark manager under this reddit post.

1. Bookmark dedupe - I often bookmark all of my tabs because I'm afraid of losing them all when Firefox crashes (rare but happens).
2. Automatic weeding out of pages that have gone 404 or domains expired etc or just generally not retrievable anymore.
3. Automatic grouping by topic and sorting by date added.
4. Auto bookmark a tab that has been open for more than x days because it's probably something important to me.
Enter fullscreen mode Exit fullscreen mode

2. Observability (from zero to hero)
Whenever writing a log message, it should answer why not what. There is a good write up by Abhishek Veeramalla on observability. It covers broad topics and detailed description about it using Go. Details can be found here. It covers below topics:

  • Day 1: Introduction to Observability
  • Day 2: Prometheus - Setting Up Monitoring
  • Day 3: Metrics and PromQL in Prometheus
  • Day 4: Instrumentation and Custom Metrics
  • Day 5: Logging with EFK Stack
  • Day 6: Distributed Tracing with Jaeger
  • Day 7: OpenTelemetry โ€“ Setting Up Unified Observability

3. Cyphernetes by Avital Tamir
Cyphernetes - A Kubernetes Query Language.

Turn your boring kubectl shell commands

# Select all zero-scaled Deployments in all namespaces,
# find all Ingresses routing to these deployments -
# for each Ingress change it's ingress class to 'inactive':

kubectl get deployments -A -o json | jq -r '.items[] | select(.spec.replicas == 0) | \
[.metadata.namespace, .metadata.name, (.spec.selector | to_entries | map("\(.key)=\(.value)") | \
join(","))] | @tsv' | while read -r ns dep selector; do kubectl get services -n "$ns" -o json | \
jq -r --arg selector "$selector" '.items[] | select((.spec.selector | to_entries | \
map("\(.key)=\(.value)") | join(",")) == $selector) | .metadata.name' | \
while read -r svc; do kubectl get ingresses -n "$ns" -o json | jq -r --arg svc "$svc" '.items[] | \
select(.spec.rules[].http.paths[].backend.service.name == $svc) | .metadata.name' | \
xargs -I {} kubectl patch ingress {} -n "$ns" --type=json -p \
'[{"op": "replace", "path": "/spec/ingressClassName", "value": "inactive"}]'; done; done
Enter fullscreen mode Exit fullscreen mode

Into magical declarative syntax

# Do the same thing!

MATCH (d:Deployment)->(s:Service)->(i:Ingress)
WHERE d.spec.replicas=0
SET i.spec.ingressClassName="inactive";
Enter fullscreen mode Exit fullscreen mode

It can be installed using below command:

go install github.com/avitaltamir/cyphernetes/cmd/cyphernetes@latest 
Enter fullscreen mode Exit fullscreen mode

4. Comment all entries in crontab
To disable all entries in crontab:

crontab -l | awk '{print "# "$1}' | crontab
Enter fullscreen mode Exit fullscreen mode

5. starship
Starship written in rust is the minimal, blazing-fast, and infinitely customizable prompt for any shell! You can download from here. The video by Andrew gives a detailed explanation on configuring the starship.

Thank you for reading and supporting. Kindly like it, if you find it helpful.

Top comments (0)