Skip to content

Instantly share code, notes, and snippets.

@malefs
malefs / gist:8976015
Last active August 29, 2015 13:56
Boost thread ctrl-c abbort thrift stop
#include "StanzeCam.h"
#include <signal.h>
//#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <boost/thread.hpp>
#include <boost/date_time.hpp>
#include <iostream>
# vim: ts=4 sw=4 fenc=utf-8
import bottle
@bottle.get('<file:re:^.*\.(css|less|js|jpg|png|gif|ttf)>')
def static_file(file):
return bottle.static_file(file, root='./web')
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
# Copyright (c) 2009-2010 Denis Bilenko. See LICENSE for details.
"""UDP/SSL server"""
import sys
import errno
import traceback
from gevent import socket
from gevent import core
from gevent.baseserver import BaseServer
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Sample multithreading with bottle.py
Requirements: requests, bottle
To run:
$ python app.py
To post data, open another command shell and type:
#!/usr/bin/env python
# Copyright (c) 2010 Erik Karulf ([email protected])
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
#!/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
#!/bin/bash
if [ ! -d /tmp/stream ]
then
mkdir /tmp/stream/
fi
if pgrep raspistill > /dev/null
then
echo "raspistill already running"
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@malefs
malefs / pyqt_opencv.py
Created November 23, 2015 14:46 — forked from saghul/pyqt_opencv.py
Render OpenCV video on a PyQt widget
# coding=utf8
# Copyright (C) 2011 Saúl Ibarra Corretgé <[email protected]>
#
# Some inspiration taken from: http://www.morethantechnical.com/2009/03/05/qt-opencv-combined-for-face-detecting-qwidgets/
import cv
import sys