Skip to content

Instantly share code, notes, and snippets.

@malefs
malefs / tmux.conf
Created June 10, 2017 01:00 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@malefs
malefs / rpi-led-notes.md
Created June 10, 2017 00:37 — forked from taktran/rpi-led-notes.md
Controlling Raspberry Pi 2 LEDs

Commands for controlling the Raspberry Pi 2 LEDs.

See rpi-leds for a node module that does this.

Power (PWR) LED

  • OK (ACT) LED = led0
  • Power (PWR) LED = led1

Allow access

@malefs
malefs / Flask-raspberryPi-GPIO-camera-model.py
Created June 2, 2017 14:00 — forked from benyaminsalimi/Flask-raspberryPi-GPIO-camera-model.py
simple RestApi for RaspberryPi RPIO & camera model with flask
# BPi restFull-api by @BenyaminSalimi
# you can see log of this program in "BPi.log"
from flask import Flask,jsonify,send_file
import picamera
import time
import RPi.GPIO as GPIO
app = Flask(__name__)
@malefs
malefs / mjpeg_udp.py
Created June 2, 2017 13:55 — forked from mic159/mjpeg_udp.py
Raspberry Pi MJPEG stream over UDP
from picamera import PiCamera
from io import BytesIO
import socket
import time
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
with PiCamera(resolution='VGA', framerate=5) as camera:
time.sleep(2)
@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
@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 <contact@beebotte.com>
# 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 / _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 / 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 / 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 / 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 "$@"