Skip to content

Instantly share code, notes, and snippets.

View johnmahugu's full-sized avatar

kesh johnmahugu

View GitHub Profile
@johnmahugu
johnmahugu / py2php.py
Created March 3, 2022 20:42 — forked from reusee/py2php.py
Python to php translator, compile python script to php
import ast
from cStringIO import StringIO
import sys
INFSTR = '1e308'
def interleave(inter, f, seq):
seq = iter(seq)
try:
f(next(seq))
@johnmahugu
johnmahugu / live-mjpeg-stream.py
Created March 2, 2022 21:26 — forked from ryanbekabe/live-mjpeg-stream.py
Streaming MJPEG over HTTP with gstreamr and python - WSGI version
#!/usr/bin/python
#based on the ideas from http://synack.me/blog/implementing-http-live-streaming
# Run this script and then launch the following pipeline:
# gst-launch videotestsrc pattern=ball ! video/x-raw-rgb, framerate=15/1, width=640, height=480 ! jpegenc ! multipartmux boundary=spionisto ! tcpclientsink port=9999
from Queue import Queue
from threading import Thread
from socket import socket
from select import select
from wsgiref.simple_server import WSGIServer, make_server, WSGIRequestHandler