This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo channel from user nickname.
$ python pub.py foo nickname
PUBLISH to channel #foo
| import os | |
| import asyncio | |
| import aiohttp # pip install aiohttp | |
| import aiofile # pip install aiofile | |
| REPORTS_FOLDER = "reports" | |
| FILES_PATH = os.path.join(REPORTS_FOLDER, "files") | |
| def download_files_from_report(urls): |
| #!/usr/bin/env python | |
| import requests, socket | |
| username = "" | |
| password = "" | |
| hostname = "" # your domain name hosted in no-ip.com | |
| # Gets the current public IP of the host machine. | |
| myip = requests.get('http://api.ipify.org').text |
| class TriangleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) { | |
| val paint = Paint() | |
| val path = Path() | |
| override fun onDraw(canvas: Canvas?) { | |
| super.onDraw(canvas) | |
| canvas ?: return | |
| canvas.drawPath(configurePath(canvas.width.toFloat(), path), configurePaint(paint)) | |
| } |