Skip to content

Instantly share code, notes, and snippets.

View timothymugayi's full-sized avatar
🎯
Focusing

Timothy Mugayi timothymugayi

🎯
Focusing
View GitHub Profile
import cv2
import zmq
context = zmq.Context()
footage_socket = context.socket(zmq.PUB)
footage_socket.bind("tcp://*:5555")
camera = cv2.VideoCapture(0) # init the camera
package com.zeromq;
import org.zeromq.SocketType;
import org.zeromq.ZContext;
import org.zeromq.ZMQ;
import org.zeromq.ZMQ.Socket;
public class Subscriber {
# This shows how to capture data using a pub-sub proxy
import time
from random import randint
from string import ascii_uppercase as uppercase
from threading import Thread, currentThread
import zmq
from zmq.devices import monitored_queue
# ZeroMQ response server in Python
# Binds REP socket to tcp://*:5555
# Expects b"string" from client, replies with b"Ok"
import time
import zmq
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind("tcp://*:5555")
# ZeroMQ basic client Python
# Connects REQ socket to tcp://localhost:5555
# Sends "string" to server, expects "Ok" back
import zmq
from string import ascii_letters, digits
from random import choice
context = zmq.Context()
# Socket to talk to server
source venv/bin/activate
# Upgrade pip
pip install wheel
pip install --upgrade pip
# Update all python packages
pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
from __future__ import absolute_import, unicode_literals
import os
import json
import requests
from celery.task import task
from pushsafer import Client, init
from __future__ import absolute_import, unicode_literals
# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import app as celery_app
__all__ = ['celery_app',]
from celery.schedules import crontab
# CELERY
# http://docs.celeryproject.org/en/4.4.1/userguide/configuration.html
REDIS_URL = os.environ.get('REDIS_URL', 'redis://localhost:6379/0')
CELERY_BROKER_URL = REDIS_URL
CELERY_RESULT_BACKEND = REDIS_URL
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_IGNORE_RESULT = False
from __future__ import absolute_import
import os
from celery import Celery
# Below sets the default Django settings module for the 'celery' app.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_celery_site.settings')