Skip to content

Instantly share code, notes, and snippets.

@quasoft
quasoft / packt_daily_book_notifier.py
Last active September 22, 2017 17:55
Lambda function that sends a daily E-mail with the title of the daily free eBook of Packt
import os
from datetime import datetime
from urllib.request import urlopen
import boto3
import re
CLAIM_PAGE = os.environ['claim_page']
SNS_TOPIC = os.environ['topic_arn']
EMAIL = os.environ['email']
@quasoft
quasoft / gst_tee_example.py
Created January 19, 2017 07:28
Example for using tee for both playing and saving audio
#!/usr/bin/env python3
import gi
import threading
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst
# Initialize threads
GObject.threads_init()
@quasoft
quasoft / pyqt4_systray_icon-example.py
Created October 15, 2016 20:25
Example on creating a cross platform system tray application in Python and Qt4
#!/usr/bin/env python3
import sys
from PyQt4 import QtGui
class SystemTrayIcon(QtGui.QSystemTrayIcon):
def __init__(self, icon, parent=None):
self.event_play_click = None
self.event_pause_click = None
self.event_exit_click = None
@quasoft
quasoft / python_daemonize_example.py
Created October 9, 2016 17:12
Example on using daemonize module in Python
#!/usr/bin/env python3
import os
import sys
import time
from daemonize import Daemonize
def main():
while True:
time.sleep(10)
#!/usr/bin/env python3
import signal
import daemon
import lockfile
import time
def start():
print("Initial setup")
@quasoft
quasoft / gst_uridecodebin_example.py
Created October 8, 2016 19:11
Using GStreamer with uridecodebin as radio player
#!/usr/bin/env python3
import gi
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst
# Initialize threads
GObject.threads_init()
@quasoft
quasoft / gst_playbin_sink_example.py
Created October 8, 2016 19:10
Using GStreamer with playbin and custom sink as radio player
#!/usr/bin/env python3
import gi
import threading
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst
# Initialize threads
GObject.threads_init()
@quasoft
quasoft / gst_playbin_audio_filter_example.py
Created October 8, 2016 19:08
Using GStreamer with playbin and audio filter as radio player
#!/usr/bin/env python3
import gi
import threading
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst
# Initialize threads
GObject.threads_init()
@quasoft
quasoft / placexample.py
Created October 8, 2016 13:43
Example for argument parsing with `plac` in Python
#!/usr/bin/env python3
def main(
someoption: ('Optional argument', 'option', 'o'), # Optional argument with abbreviation
someflag: ('Boolean flag - True if set', 'flag', 'f'), # Boolean flag
someint: ("Integer argument",'positional', None, float), # Explicit positional with number type
somestring:"String argument"='hello' # Implicit positional with default value
):
"""Example for parsing arguments with plac"""
print('someint value: %d' % someint)
@quasoft
quasoft / delphi-directives.md
Last active January 5, 2018 09:00
Delphi product/compiler versions

List of Delphi product/compiler versions and conditional directives:

Product Product Version CompilerVersion Directive
Delphi 10.1 Berlin 24 31 VER310
Delphi 10 Seattle 23 30 VER300
Delphi XE8 22 29 VER290
Delphi XE7 21 28 VER280
Delphi XE6 20 27 VER270
Delphi XE5 19 26 VER260