Skip to content

Instantly share code, notes, and snippets.

lib_name='trap'
lib_version=20121026
stderr_log="/dev/shm/stderr-$(date +%s).log"
#
# TO BE SOURCED ONLY ONCE:
#
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
# if you don't have it, install ccze
sudo apt-get install -y ccze
# add this alias at the end of your $HOME/.bashrc
# idea from: https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-log
alias nrlog="sudo journalctl -f -n 50 -u nodered -o cat | ccze -A"
# source .bashrc, to make the alias available immediately, or just reboot your system...
. $HOME/.bashrc
# to remove old version:
sudo dpkg -r grafana grafana-data
sudo apt-get -y autoremove
sudo rm -rf /etc/grafana /var/lib/grafana /var/log/grafana /etc/rc5.d/S02grafana /etc/rc6.d/K01grafana /etc/rc3.d/S02grafana /etc/rc2.d/S02grafana /etc/rc4.d/S02grafana /etc/rc1.d/K01grafana /etc/default/grafana /etc/init.d/grafana /etc/rc0.d/K01grafana /usr/lib/systemd/system/grafana-server.service /etc/systemd/system/grafana-server.service /etc/systemd/system/grafana.service /etc/systemd/system/multi-user.target.wants/grafana.service /etc/apt/sources.list.d/grafana.list /etc/default/grafana-server /etc/init.d/grafana-server /var/lib/systemd/deb-systemd-helper-enabled/grafana-server.service /var/lib/systemd/deb-systemd-helper-enabled/grafana.service.dsh-also /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/grafana.service /var/lib/systemd/deb-systemd-helper-masked/grafana.service /home/pi/grafana_2.6.0+dfsg-3_armhf.deb /home/pi/grafana-data_2.6.0+dfsg-3_all.deb
# to install latest:
curl https://bintray.
# add to .bashrc
# format: |current time|user (white: normal, red: root)@hostname (green: last command successful, red: error occurred):[current folder]-(num files and total size)-Cores: (num active cores) at (cpu temperature)>
# CPU readings thanks to DietPi (/DietPi/dietpi/dietpi-cpuinfo)
CPU_TEMP_CURRENT='Unknown'
CPU_TEMP_PRINT='Unknown'
ACTIVECORES=$(grep -c processor /proc/cpuinfo)
#Array to store possible locations for temp read.
aFP_TEMPERATURE=(
#!/bin/bash
# Starts and stops Blynk-Server
# /etc/init.d/blynk
### BEGIN INIT INFO
# Provides: Blynk-Server
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Blynk-Server initialisation
@fragolinux
fragolinux / full-update-node-red-server
Last active May 6, 2020 07:10
Full automatic update of a Debian/Ubuntu Node-Red server
sudo apt-get -y update
sudo apt-get -y install deborphan > /dev/null 2>&1
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
deborphan -sz
sudo apt-get -y autoremove
sudo apt-get -y remove --purge $(deborphan)
sudo apt-get -y clean
sudo chown -R pi.pi ~/.node-red/node_modules
# Steps to install ThingSpeak server on Raspbian Jessie, based on info taken from, in no particular order:
# https://gist.github.com/blacktm/8302741
# https://gist.github.com/sourceperl/b84ab0d723bda21321fc/
# https://github.com/iobridge/thingspeak
# http://www.esp8266-projects.com/2015/11/raspberry-pi2-thingspeak-on-jessie.html
# http://www.esp8266-projects.com/2015/05/raspberry-pi-standalone-thingspeak.html
# http://www.cnx-software.com/2016/12/07/how-to-install-thingspeak-in-ubuntu-16-04/
# install requirements
sudo apt-get -y update