Skip to content

Instantly share code, notes, and snippets.

View maxtacu's full-sized avatar
🏠
Working from home

Maxim Tacu maxtacu

🏠
Working from home
View GitHub Profile
@maxtacu
maxtacu / countertimer.py
Last active February 12, 2022 14:28
Python countdown timer https://youtu.be/9QSo3F6sM1w
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--time', type=int, required=True, help="Time in seconds")
parser.add_argument('-o', '--output',default="counter.txt", help="Output file")
args = parser.parse_args()
def countdown(t):
while t:

Keybase proof

I hereby claim:

  • I am tmxak on github.
  • I am maxtacu (https://keybase.io/maxtacu) on keybase.
  • I have a public key ASDdxH0QwYgyH6g-d4QhZdneR1qF_1nQC5cODUosWHFI-Qo

To claim this, I am signing this object:

@maxtacu
maxtacu / discussioncleaner.py
Created March 22, 2020 22:12
Telegram webhook bot for cleaning forwarded channel messages in discussion group
import telebot, os
from flask import Flask, request
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
keyfile = open(os.path.join(__location__, 'apiKey.txt'), "r")
token = keyfile.read().replace('\n', '')
secret = 'SECRET-URL-PATH' # for example: 2412qweh15sf14s234jeqwe
url = 'YOUR-URL/' + secret
@maxtacu
maxtacu / eks-kubeconfig.go
Last active August 4, 2023 09:49
Update your kubeconfig with all EKS clusters
package main
import (
"encoding/json"
"fmt"
"log"
"os/exec"
)
type EKSClusters struct {
@maxtacu
maxtacu / hubitat-backup.sh
Last active October 3, 2023 03:58
Download latest Hubitat backup using API
#!/bin/bash
# Your hubitat IP
HUBITAT=1.2.3.4
# Backup output path parameter. Default: "." current path where you execute the script.
BACKUP_PATH="${1:-.}"
# Get the name of the latest backup file
REMOTE_BACKUP=`curl -s "http://$HUBITAT:8081/api/backups" | jq -r '.backups[0].name'`
# Download backup
curl -s "http://$HUBITAT:8081/api/downloadBackup/$REMOTE_BACKUP" -o $BACKUP_PATH/backup.lzf
@maxtacu
maxtacu / athena-queries.md
Last active March 26, 2024 11:59
Top AWS Athena queries for extracting insights from ALB access logs

Top AWS Athena queries for ALB access logs

Here, in one place, are some valuable queries for extracting insights and troubleshooting potential problems that I have gathered myself during my SRE experience, or found and used from the web:

  1. Total Requests by Day:
SELECT 
    date(parse_datetime(time, 'yyyy-MM-dd''T''HH:mm:ss.SSSSSSZ')) AS day,
    COUNT(*) AS total_requests
FROM alb_logs
GROUP BY date(parse_datetime(time, 'yyyy-MM-dd''T''HH:mm:ss.SSSSSSZ'))
ORDER BY day DESC;