Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / runinenv.sh
Created April 25, 2016 15:42 — forked from parente/runinenv.sh
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@malefs
malefs / readserial.py
Created April 29, 2016 14:38 — forked from andypiper/readserial.py
Scrape serial port for text data and publish on MQTT
#!/usr/bin/python
#
#simple app to read string from serial port
#and publish via MQTT
#
#uses the Python MQTT client from the Mosquitto project
#http://mosquitto.org
#
#Andy Piper http://andypiper.co.uk
#2011/09/15
@malefs
malefs / motion_detect.cpp
Created June 3, 2016 21:49 — forked from tanmaykm/motion_detect.cpp
OpenCV Motion Detection Based Action Trigger
/*
* motion_detect.cpp
* To accompany instructions at:
* http://sidekick.windforwings.com/2012/12/opencv-motion-detection-based-action.html
*
* Created on: Dec 02, 2012
* Author: tan
*
*/
#include <iostream>
@malefs
malefs / _README.md
Created January 5, 2017 21:04 — forked from oleq/_README.md
A2DP audio streaming using Raspberry PI (Raspbian Jessie)

What is this all about?

This tutorial will turn your Raspberry PI into a simple Bluetooth audio receiver, which plays music through connected speakers. It's like a regular car audio system, but it can be used anywhere and it's a good value.

   Audio source (i.e. smartphone) 
                |
                v
 (((  Wireless Bluetooth Channel  )))
 |
@malefs
malefs / bbt_mqtt.py
Created January 10, 2017 14:33 — forked from bachwehbi/bbt_mqtt.py
Simple example showing how to use MQTT in Beebotte. This code uses the Paho.mqtt Python client library.
#!/usr/bin/python
# Copyright (c) 2013-2014 Beebotte <[email protected]>
# This program is published under the MIT License (http://opensource.org/licenses/MIT).
############################################################
# This code uses the Beebotte API, you must have an account.
# You can register here: http://beebotte.com/register
#############################################################
@malefs
malefs / PiCameraStream
Created May 2, 2017 16:20 — forked from nioto/PiCameraStream
Simple MJpeg streamer for Raspberri Pi Camera
#!/usr/bin/python
'''
A Simple mjpg stream http server for the Raspberry Pi Camera
inspired by https://gist.github.com/n3wtron/4624820
'''
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
import io
import time
import picamera