Skip to content

Instantly share code, notes, and snippets.

@mikerr
mikerr / PiCameraStream
Created October 11, 2016 17:33 — 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
@mikerr
mikerr / Microserver roles
Created September 27, 2016 15:07
Microserver roles
Fileserver:
Samba (Windows PCs)
NFS (Linux / pi )
Owncloud file sync (LAN / internet / mobile)
Media:
torrent box (transmission-daemon & chrome / firefox addons)
plex server (to chromecasts / phones /tablets)
sudo apt-get update && apt-get install samba rpi-update
sudo apt-get install dnsmasq tcpbump nfs-kernel-server
sudo mkdir -p /nfs/rpilite /tftpboot
sudo BRANCH=next rpi-update
@mikerr
mikerr / 03-tftpboot.conf
Last active September 30, 2020 22:42
Add network boot (TFTP) to pihole (dnmasq)
# /etc/dnsmasq.d/03-tftpboot.conf
enable-tftp
tftp-root=/tftpboot
pxe-service=0,"Raspberry Pi Boot"
@mikerr
mikerr / 00-dhcpd.conf
Created August 12, 2016 16:31
Add dhcpd server to pi-hole ad blocker
# /etc/dnsmasq.d/00-dhcpd.conf
dhcp-range=192.168.0.30,192.168.0.245,255.255.255.0,72h
dhcp-option=3,192.168.0.1
dhcp-option=option:dns-server,192.168.0.22,192.168.0.22
dhcp-authoritative
@mikerr
mikerr / gpsweb.py
Last active July 24, 2016 23:14
Show GPS coords in a web browser
import gps
from flask import Flask
app = Flask(__name__)
@app.route("/")
def location():
session = gps.gps("localhost", "2947")
session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE)
report = session.next()
while report['class'] != 'TPV':
@mikerr
mikerr / setup.sh
Created June 18, 2016 10:46
Standard pi setup - with network share
Raspbian Lite
raspi-config
enable camera
add wifi to /etc/wpa_supplicant/wpa_supplicant.conf
apt-get install samba
edit /etc/samba/smb.conf
[home]
path = /home/pi
read only = no
@mikerr
mikerr / vidcap.sh
Created June 18, 2016 10:45
Continuously capture video in 30 second segments
now=$(date +"%Y%m%d-%H%M") # 20160618-1143
raspivid -w 640 -h 640 -t 0 -sg 30000 -o $now-%d.mpg
@mikerr
mikerr / wifiorder.bat
Last active June 2, 2016 13:59
View / change priority of wifi SSIDs in windows 10
@echo off
rem usage: wifiorder mySSID 1
netsh wlan show profiles
netsh wlan show profiles|find "Profiles on interface">c:\temp\temp.$$$
for /f "tokens=1 delims=," %%f in (c:\temp\temp.$$$) do set Interface=%%f
set Interface=%Interface:~22,-1%
echo %Interface%
netsh wlan set profileorder name="%1" Interface="%Interface%" priority=%2
netsh wlan show profiles
@mikerr
mikerr / interfaces
Created May 14, 2016 20:16
Pi network interfaces file
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp