Pi Zero Network Webcam

apt update
apt upgrade -y
apt install -y socat

echo "start_x=1" >> /boot/config.txt
echo "gpu_mem=256" >> /boot/config.txt
echo "bcm2835-v4l2" >> /etc/modules

reboot

# test with:
raspivid -f -t 0

base64 -d <<"EOF" | gzip -d > ~/stream.sh
H4sIAFCef18AA41UXU/bMBR9rn/FpSC6iaZt+BIU8TB1Zar2QdWyaRKCyU1uiFUnjmynoUD/+67j
dlRsD8uLY/vec8499ya7O92ZyLszblLGRAK3sPe8u4IgRwjhDl5e6KS59xyumrBzCU1jNfKsCXcX
YFPMWaNKhUToX0CsWKNhVMQt3AzGwZfR9Gb4rX/WOwvbGkuDPI41DH8OB/1Wp+thOiYF/9ZyuRKx
gF7nBHaBS6kqwEdhYSE43A/uB6wRqxxZIhgzaCHAkrHp9eDzZbMb46Jr0uwPqormTXYLOxBMnXYX
RfLvYH8fdAZB8nroo/BtVDZPRKK2wlgkkedl8e49PLNGnfRERo1HH39NPkzHox+jj/2Dp5XPngsp
ITh/c796k3d19XU8/FRnwb/y/P2KrZjVvIC1AHJwdLNuVGBdizaNwCglxcPJ5HrSJ1djVVoQBjhY
1JnIuex0Ok0Kc56GtY2am0IsROyAehDM4Oik5x4IgkKrxPU1FQ8pbSUuUMJx5xCCCsLzQwpJIeyd
0ZoUBo5o5dUMeGkVufm4eVnAQUgRVJSBQIDGSGli2zIW9tm2R5d7O4wlSVbgg2tTenh6DIGu8cVW
UhCpGKP+AiJVLF2gS7DEsYbz1tVgu6DLHIzKEBLNMzRAyh5ofmjxRG3geVx7CAWnOXWvQOYV5J9K
YGMSIa2FSTH3MClfIPkrlZoDTb3L8xMIM0yUdjuurcgfICmlXLZJBt24fU3kICmtDqLGxgpN3rJQ
KT13/NQu5j+J8JD50fg+nYR/TRWhVJx6SowbhaRtg+pqi1RuyswXlghtKBartR1tX3mZ+9q3quUJ
Dc4GMeXGQ2LcBmFbpMbyeV29sJYGxf8GnKkiF/RZe05Xa81aczkLtcqAz9QCqbxX3TYVta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