Skip to content

Instantly share code, notes, and snippets.

@kepsic
kepsic / schedule_astro.py
Last active January 15, 2023 00:00
Python schedule extension to run task on sunset or sunrise
#!/usr/bin/env python3
# This is attempt to mix together python astro and schedule.
# Author: Andres Kepler <andres@kepler.ee>
import datetime
from astral import LocationInfo
from astral.sun import sun
from schedule import Scheduler as _Scheduler
from schedule import Job as _Job
@kepsic
kepsic / webrelay-sms-voice.ino
Created September 26, 2019 10:36
ProDino MKR GSM Ethernet V1 -
// WebRelay.ino
// Company: KMP Electronics Ltd, Bulgaria
// Web: https://kmpelectronics.eu/
// Supported boards:
// - KMP ProDino MKR Zero Ethernet V1 (https://kmpelectronics.eu/products/prodino-mkr-zero-ethernet-v1/)
// - KMP ProDino MKR GSM Ethernet V1 (https://kmpelectronics.eu/products/prodino-mkr-gsm-ethernet-v1/)
// Description:
// Manage relays through web page. In the page you can view a board relays statuses and change them.
// Example link: https://kmpelectronics.eu/tutorials-examples/prodino-mkr-versions-examples/
// Version: 1.0.0
@kepsic
kepsic / 10g-1g-detect.sh
Last active August 13, 2019 21:01
Detect 10G and 1G odd or even interface names under FreeBSD
#!/bin/sh
connected_interfaces=`ifconfig -a | awk '{FS=":";interfaces="";if (substr($1,length($1),1)%2 == 0) {
iface=$1;
if (iface ~ /^[a-z]+[0-9]/) {
getmedia="ifconfig " iface
while ((getmedia |getline) > 0)
if ($1 ~ /media/) {
media=$2
connected_1g = match(media, /.*\(1000.*\).*/)
connected_10g = match(media, /.*\(10.*\).*/)
@kepsic
kepsic / notify.py
Last active July 12, 2018 07:53
FlexBi import monitor script
#!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb
import datetime
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
current_date = datetime.datetime.now()
#!/usr/bin/env python3
import os,shutil
import datetime
path=os.path.expanduser('~')
archdir='archive'
exclude=[archdir, '.ssh', '.vimrc', '.hgrc', 'tmp','.viminfo',os.path.basename(__file__)]
cwd = os.getcwd()
if not os.path.isdir(path+'/'+archdir):
os.makedirs(path+'/'+archdir)
@kepsic
kepsic / hw_invoice_fix.py
Created January 19, 2017 09:26
This will fix missing currency from given HansaWorld input file.
#!/usr/bin/env python
import sys
import os
__author__ = "Andres Kepler"
__copyright__ = "Copyright 2017,0XFF"
__license__ = "GPL"
__version__ = "0.1"
__email__ = "andres@kepler.ee"
#Usage: Export from integration module base regster desired invoice
#!/urs/bin/env python
import pyttsx
import argparse
import time
import sys
engine = pyttsx.init()
def onEnd(name, completed):
sys.exit(0)
parser = argparse.ArgumentParser(description='text to speech')
parser.add_argument('text')
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
#ref http://effbot.org/pyfaq/how-do-i-get-a-single-keypress-at-a-time.htm
#ref https://en.wikipedia.org/wiki/NATO_phonetic_alphabet
import termios, fcntl, sys, os
alfabet={
"1":{"a":"One","m":".----"},
"2":{"a":"Two","m":"..---"},
"3":{"a":"Three","m":"...--"},
"4":{"a":"Four","m":"....-"},
@kepsic
kepsic / check.py
Last active August 7, 2022 06:46
#!/usr/bin/env python3
"""
DESCRIPTION
Email checker
INSTALL
sudo apt-get install python3-pip
pip3 install validate_email
pip3 install py3DNS
chmod 755 check.py
./check.py --validate kepsicsassasaa@hot.ee --debug