Skip to content

Instantly share code, notes, and snippets.

@slavikme
slavikme / send-telegram-on-high-loads.sh
Last active March 28, 2018 10:19
On high system loads turn off http service and send Telegram notification
#!/bin/bash
MAX_THRESHOLD=${MAX_THRESHOLD:-4}
MIN_THRESHOLD=${MIN_THRESHOLD:-2}
TELEGRAM_API="https://api.telegram.org/bot$BOT_API_TOKEN"
monit=`cat /proc/loadavg`
load=`echo $monit | cut -d' ' -f1`
pid=`echo $monit | cut -d' ' -f5`
pinfo=`ps -p $pid u`
@slavikme
slavikme / freefit-get-info-json.py
Created March 26, 2018 11:08
Scrape all clubs and their info from FreeFit.co.il service
import requests
from requests_html import HTMLSession
import json
import datetime
session = HTMLSession()
now = datetime.datetime.now()
def getMoreInfo(id):
url = 'https://freefit.co.il/CLUBS/?CLUB=%d&SUBCLUBCATEGORY=-1' % id