Skip to content

Instantly share code, notes, and snippets.

@raspberrypisig
raspberrypisig / expandSDfilesystemRpi.sh
Last active November 12, 2015 22:56
Expand filesystem to fill up SD card on raspberry pi on non-raspbian distros like kali linux
sudo su
cat <<EOF > /etc/init.d/resize2fs_once
#!/bin/sh
### BEGIN INIT INFO
# Provides: resize2fs_once
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5 S
# Default-Stop:
# Short-Description: Resize the root filesystem to fill partition
// The instructions https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=121195 will get
// chromium 45 installed on rpi2 with jessie, but couldn't get it to run
// This is how I did it
//run from terminal under user pi - one time operation
mkdir /home/pi/chromium
cat <<EOF > start-chrome.sh
lxterminal --command='sudo chromium-browser --disable-setuid-sandbox --user-data-dir=/home/pi/chromium'
EOF
chmod +x start-chrome.sh
#!/bin/bash
cd /home/pi
apt-get update
echo "deb http://packages.openmediavault.org/public erasmus main" | tee -a /etc/apt/sources.list.d/openmediavault.list
wget -O - http://packages.openmediavault.org/public/archive.key | apt-key add -
apt-get update
debconf-set-selections <<< "postfix postfix/mailname string localhost"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
apt-get install -y --force-yes openmediavault-keyring postfix
apt-get update
sudo cat > /etc/default/keyboard <<EOF
XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""
BACKSPACE="guess"
EOF
sudo invoke-rc.d keyboard-setup start
sudo udevadm trigger --subsystem-match=input --action=change
#!/bin/bash
wget -O /home/pi/ffmpeg.deb https://github.com/ccrisan/motioneye/wiki/precompiled/ffmpeg_3.1.1-1_armhf.deb
dpkg -i /home/pi/ffmpeg.deb
apt-get install -y python-pip python-dev curl libssl-dev libcurl4-openssl-dev libjpeg-dev libx264-142 v4l-utils
wget -O /home/pi/motion.deb https://github.com/Motion-Project/motion/releases/download/release-3.4.1/motion_3.4.1raspbianjessierc01-1_armhf.deb
dpkg -i /home/pi/motion.deb
pip install motioneye
mkdir -p /etc/motioneye
cp /usr/local/share/motioneye/extra/motioneye.conf.sample /etc/motioneye/motioneye.conf
mkdir -p /var/lib/motioneye
#!/bin/bash
wget -O raspi-config.html -c "http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/?C=M;O=D"
filename=$(grep -n '<a href="raspi-config_' raspi-config.html|head -1 |sed -n 's/.*href="\([^"]*\).*/\1/p')
url="http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/$filename"
echo $url
wget -c $url
dpkg -i $filename
rm -rf raspi-config.html
{"cod":"200","message":0.0098,"cnt":37,"list":[{"dt":1486890000,"main":{"temp":13.71,"temp_min":13.71,"temp_max":13.71,"pressure":1005.62,"sea_level":1023.16,"grnd_level":1005.62,"humidity":88,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}],"clouds":{"all":100},"wind":{"speed":3.55,"deg":254.501},"rain":{},"sys":{"pod":"d"},"dt_txt":"2017-02-12 09:00:00"},{"dt":1486900800,"main":{"temp":13.38,"temp_min":13.38,"temp_max":13.38,"pressure":1006.57,"sea_level":1024.24,"grnd_level":1006.57,"humidity":87,"temp_kf":0},"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04n"}],"clouds":{"all":100},"wind":{"speed":3.26,"deg":263.001},"rain":{},"sys":{"pod":"n"},"dt_txt":"2017-02-12 12:00:00"},{"dt":1486911600,"main":{"temp":13.47,"temp_min":13.47,"temp_max":13.47,"pressure":1005.82,"sea_level":1023.43,"grnd_level":1005.82,"humidity":88,"temp_kf":0},"weather":[{"id":500,"main":"Rain","description":"light rain","icon":"10n"}],"clouds":{"all":88},"
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="extract-plot-data.js"></script>
</head>
<body>
<div id="container"/>
function getWeatherData() {
var url = 'https://gist.githubusercontent.com/raspberrypisig/32e1399e26e3f174d1a7504abdd37b1f/raw/1a785324283d6b3a0c86699e7e74cf325022f684/weather.json';
$.getJSON(url, function(data){
var filteredData;
filteredData = data.list.reduce(function(extractedData, datapoint) {
extractedData.push([datapoint.dt,datapoint.main.temp]);
return extractedData;
},[]);
[{"id":"b3ea0c65.273048","type":"inject","z":"66f31273.a277dc","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":120.49998474121094,"y":50.59999084472656,"wires":[["7f03a9bc.004b58"]]},{"id":"163fd9ec.660ad6","type":"http request","z":"66f31273.a277dc","name":"","method":"POST","ret":"obj","url":"https://api.telstra.com/v1/oauth/token","tls":"","x":442.5,"y":55.19999694824219,"wires":[["fc694715.ed64c"]]},{"id":"ac66338c.040f38","type":"function","z":"66f31273.a277dc","name":"","func":"msg.headers={\n 'Content-Type':'application/x-www-form-urlencoded' \n};\nmsg.originalpayload = msg.payload;\nmsg.payload={\n client_id: msg.payload.CONSUMER_KEY,\n client_secret: msg.payload.CONSUMER_SECRET,\n grant_type: \"client_credentials\",\n scope: \"SMS\"\n};\nreturn msg;","outputs":1,"noerr":0,"x":275.5,"y":55,"wires":[["163fd9ec.660ad6"]]},{"id":"66203ba4.a5a314","type":"http request","z":"66f31273.a277dc","name":"","method":"POST","ret":"txt","url":"https://api.telst