Skip to content

Instantly share code, notes, and snippets.

View aluminiumgeek's full-sized avatar
🚷
🚳

Mikhail Mezyakov aluminiumgeek

🚷
🚳
View GitHub Profile
@aluminiumgeek
aluminiumgeek / utils.py
Last active February 16, 2016 18:16
This decorator caches returning value from a function/method
# I suggest you use memcached or redis as backend
import time
import json
from functools import wraps
def cached(timeout=1800):
def wrapper(f):
@wraps(f)
@aluminiumgeek
aluminiumgeek / monitor.py
Created January 30, 2020 09:09
[Python] Simple website downtime monitor (+ Pushover)
import time
from datetime import datetime
import requests
URL = 'https://example.com'
CHECK_SECONDS = 60
def monitor():
@aluminiumgeek
aluminiumgeek / number_to_georgian.py
Last active February 28, 2025 16:24
Number to Georgian (Amount/price to Georgian)
def number_to_georgian(amount, currency):
if currency == 'GEL':
main_unit = 'ლარი'
fractional_unit = 'თეთრი'
elif currency == 'USD':
main_unit = 'დოლარი'
fractional_unit = 'ცენტი'
elif currency == 'EUR':
main_unit = 'ევრო'
fractional_unit = 'ცენტი'