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 / 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},
@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