Skip to content

Instantly share code, notes, and snippets.

View ySnoopyDogy's full-sized avatar
🎯
Focusing

Luan Caliel ySnoopyDogy

🎯
Focusing
View GitHub Profile
@ySnoopyDogy
ySnoopyDogy / change_go_version.sh
Created October 2, 2025 04:03
Bash script to change the current user Go's version to any installed
#!/usr/bin/env bash
# Just let the versions ziped files in the same directory as the script
# For reference, in my ~/document/multiversiongolang I have:
# 1.18.gz 1.21.gz 1.22.gz 1.23.gz 1.25.gz change_go_version.sh
# In .bashrc, I got the alias:
# alias cgo='bash ~/documents/multiversiongolang/change_go_version.sh'
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@ySnoopyDogy
ySnoopyDogy / dnsMonitor.sh
Created February 16, 2024 00:34
Alert DNS resolution problems in Discord
#!/bin/bash
WEBHOOK_URL="https://discord.com/api/v10/webhooks/XXX/XXX"
NAME_TO_CHECK="luancaliel.dev"
TEST_FREQUENCY="2"
USER_TO_MENTION="435228312214962204"
alert_debounce=true
healthy=true
@ySnoopyDogy
ySnoopyDogy / RandomFromProbability.ts
Last active October 28, 2021 00:52
A function that return an element among other elements based on a set probability for each one
interface ProbabilityProps<T> {
probability: number;
value: T;
}
// Input Example:
/* calculateProbability([
{value: 'Cat', probability: 29},