Skip to content

Instantly share code, notes, and snippets.

@bmweiner
bmweiner / raspberrypi.md
Last active November 16, 2018 00:30
Raspberry Pi system administration.
@bmweiner
bmweiner / sonos_airplay.md
Last active December 30, 2023 19:30
Stream audio to any Sonos component via AirPlay using a Raspberry Pi.

Sonos Airplay

Stream audio to any Sonos component via AirPlay using a Raspberry Pi (Model B, Raspbian Jessie) and the following software:

  • Shairport Sync: configures the Raspberry Pi as an AirPlay audio player.
  • DarkIce: encodes audio received from AirPlay (system audio) and sends it to Icecast2.
  • Icecast2: serves streaming audio from DarkIce at a network URL.
@bmweiner
bmweiner / ts.r
Last active August 16, 2017 22:20
# Time Series Forecasting in R
## Example Datasets
# R Datasets package (e.g. AirPassengers, austres)
# https://stat.ethz.ch/R-manual/R-devel/library/datasets/html/00Index.html
# Census Time Series
# https://www.census.gov/econ/currentdata/dbsearch
# Data used for this demo:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
@bmweiner
bmweiner / array.py
Last active July 21, 2017 20:29
Common routines with numpy
from functools import reduce
import numpy as np
def mor(x):
"""x: iterable of np.array."""
return reduce(np.logical_or, x)
def mand(x):
"""x: iterable of np.array."""
return reduce(np.logical_and, x)
@bmweiner
bmweiner / compare_dataframes.ipynb
Last active September 30, 2017 14:21
Compare equality of two pandas dataframes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmweiner
bmweiner / amcrest
Last active November 17, 2018 15:26
# Amcrest API
## change password
http://<server>/cgi-bin/userManager.cgi?action=modifyPassword&name=<username>&pwd=<newPwd>&pwdOld=<oldPwd>
## take snapshot
http://<server>/cgi-bin/snapshot.cgi
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# installs home assistant core on raspberry pi
#
# source: https://www.home-assistant.io/docs/installation/raspberry-pi/
#
# pre-requisite
# install Raspberry PI OS
# ssh into pi clone this script and execute
sudo apt-get update
sudo apt-get upgrade -y