Skip to content

Instantly share code, notes, and snippets.

@malefs
malefs / supervisord.service
Created April 25, 2016 15:39 — forked from andreaskweber/supervisord.service
Running supervisord with systemd on Debian Jessie
#
# /etc/systemd/system/supervisord.service
#
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
@malefs
malefs / gist:abba938c4836181783f6
Created March 23, 2016 23:00 — forked from spikedrba/gist:38a90e76cfce43c5e358
picamera mjpeg streaming test
#!/usr/bin/env python
import picamera
import socket
with picamera.PiCamera() as camera:
camera.resolution = (1296, 730)
camera.vflip = True
camera.start_preview()
@malefs
malefs / pmd.py
Created March 23, 2016 22:58 — forked from spikedrba/pmd.py
RPi Motion detection with picamera python lib
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script was originally created by by killagreg î Thu Dec 18, 2014 7:53 am
# see http://www.raspberrypi.org/forums/viewtopic.php?p=656881#p656881
# This script implements a motion capture surveillance cam for raspberry pi using picam
# and is based on the picamera python library.
# It uses the "motion vectors" magnitude of the h264 hw-encoder to detect motion activity.
@malefs
malefs / ldr.py
Created January 22, 2016 15:28 — forked from electronut/ldr.py
Display analog data from Arduino using Python (matplotlib animation)
"""
ldr.py
Display analog data from Arduino using Python (matplotlib)
Author: Mahesh Venkitachalam
Website: electronut.in
"""
import sys, serial, argparse
@malefs
malefs / dhcpd.conf
Created January 13, 2016 09:43
Raspberry PI router
#/etc/dhcp/dhcpd.conf
option domain-name "local";
option domain-name-servers 8.8.8.8, 8.8.4.4;
max-lease-time 3600;
default-lease-time 3600;
log-facility local7;
@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
## 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
#!/bin/bash
if [ ! -d /tmp/stream ]
then
mkdir /tmp/stream/
fi
if pgrep raspistill > /dev/null
then
echo "raspistill already running"
#!/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
#!/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