Skip to content

Instantly share code, notes, and snippets.

View cdalvaro's full-sized avatar
🚀

Carlos D. Álvaro cdalvaro

🚀
View GitHub Profile
@cdalvaro
cdalvaro / Grafana Alert Template.md
Created January 3, 2024 10:44 — forked from Himura2la/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{ define "alert_list" }}{{ range . }}{{ .Labels.alertname }}
    {{ range .Annotations.SortedPairs }}<strong>{{ .Name }}</strong>: {{ .Value }}
    {{ end }}| {{ if gt (len .GeneratorURL) 0 }}<a href="{{ .GeneratorURL }}">source</a> | {{ end }}{{ if gt (len .SilenceURL) 0 }}<a href="{{ .SilenceURL }}">silence</a> | {{ end }}{{ if gt (len .DashboardURL) 0 }}<a href="{{ .DashboardURL }}">dashboard</a> | {{ end }}{{ if gt (len .PanelURL) 0 }}<a href="{{ .PanelURL }}">panel</a> |{{ end }}
    —
    {{ end }}{{ end }}
    {{ define "telegram.message" }}
    

{{ if gt (len .Alerts.Firing) 0 }}FIRING!!!

@cdalvaro
cdalvaro / Grafana Alert Template.md
Created January 3, 2024 10:44 — forked from gelldur/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{- /* Telegram message to use: {{ template "telegram.message2" . }} */ -}}
    {{ define "__alerts_list" -}}
    {{ range . }}
    {{if ne (index .Labels "alertname") "" -}}
    {{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }}
        {{- if ne (index .Labels "severity") "" -}}
            <u><b>P{{ index .Labels "severity" }}</b></u> {{ end -}}
@cdalvaro
cdalvaro / free_ports.sh
Created November 13, 2021 12:57 — forked from hjbotha/free_ports.sh
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
# Run this script as root

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get a single character ${VARNAME[index]}
Get the string from a specific index ${VARNAME[index,-1]}
@cdalvaro
cdalvaro / SyncTheme.py
Last active February 7, 2021 11:02 — forked from saagarjha/theme.py
iTerm2 Script to change the theme automatically based on the system appearance
#!/usr/bin/env python3
import iterm2
async def set_theme(connection, theme):
# Themes have space-delimited attributes, one of which will be light or dark.
parts = theme.split(" ")
if "dark" in parts:
preset = await iterm2.ColorPreset.async_get(connection, "GitHub Dark")

Keybase proof

I hereby claim:

  • I am cdalvaro on github.
  • I am cdalvaro (https://keybase.io/cdalvaro) on keybase.
  • I have a public key whose fingerprint is 91DB 2FD1 CE5A 3545 9250 FEFC E0F9 B75C 3246 CEB5

To claim this, I am signing this object:

@cdalvaro
cdalvaro / gpg-with-key
Last active August 1, 2024 10:44 — forked from stansidel/gpg-with-key
Setting up GPG signature on macOS with Xcode
/usr/local/bin/gpg --batch --pinentry-mode=loopback --passphrase-file ~/.gnupg/key.txt --no-tty "$@"