This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The custom Node-RED integrations from the HACS store must be installed for this to work. | |
You must create the timers you want to use in your configuration.yaml file for Home Assistant. | |
For information on creating timer entities for Home Assistant, visit https://www.home-assistant.io/integrations/timer/ | |
This flow gets the current state of the sensor.<entityID>_next_timer and converts it into a HH:MM:SS format. If there are no hours in the timer, it only displays MM:SS. | |
I suggest using a filter entities card to display the timer. A regular entity card will only return a status of "active" or "idle". I have 4 timers configured so I used the filtered entities card to only show active timers. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GlusterFS Cheat Sheet | |
# Gluster community download | |
https://download.gluster.org/pub/gluster/glusterfs/ | |
### Add a new host to the brick ### | |
## Probe new host ## | |
gluster probe peer <hostname or IP> | |
# E.G. gluster probe peer debian-master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This code is hacked together from 2 separate temp/humidity sensor projects for MQTT and OLED output | |
* Pinout is below this line | |
* OLED GND=GND VCC=VCC SCL=D1 SCA=D2 | |
* DHT22 -=GND OUT=D4 +=VCC | |
* D1 Mini Lite GND=GND VCC=3v3 | |
*/ | |
#include <SPI.h> | |
#include <Wire.h> | |
#include <ESP8266WiFi.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is used to upgrade your Raspberry Pi OS from version 9 (stretch) to version 10 (buster). | |
# It is advised to keep current configuration files to avoid breaking something else and always | |
# take a backup image of your sd card from your Raspberry Pi prior to upgrading. | |
# The script must be run as root! | |
[ "$(whoami)" != "root" ] && echo "You must be root to run this script" && exit 1 | |
apt update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=`date +%d-%b-%Y` | |
/bin/dd bs=4M if=/dev/mmcblk0 iflag=direct of=/media/usb/jgpiholebackup/jgpihole_$DATE.img | |
if [ $? != 0 ]; then | |
echo "Image creation failed. $(date)">> /var/log/doimage.log | |
exit 1 | |
fi | |
cd /media/usb/jgpiholebackup/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Setup your sonoff // | |
// Flash your sonoff switch with tasmota // | |
// Associate the tasmotized sonoff with your WiFi network // | |
// Load the webpage for the sonoff and setup your mqtt topics // | |
// Go into module setup and set GPIO14 to Switch2 // | |
// Go into the console and type "SwitchMode2 1" (without quotes) // | |
// Lastly, in the console type "PulseTime 1" (without quotes) // | |
// Setup credentials in the code // | |
// Replace asterisks next to ssid & password with WiFi credentials // |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Created by Jeffery Grantham on 2/6/2019 | |
# Checking if "at" is installed. If not, apt-get will install it. | |
if [[ $(which at) != "/usr/bin/at" ]]; then | |
apt-get install at -y | |
fi | |
# Proceeding to check for updates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# linuxmaintenance.sh | |
# Authored Sep 7 2018 by Jim | |
# Optimized Jan 4 2019 by Jeffery Grantham | |
# You must have a file named hosts.txt containing each hostname or FDQN for the boxes of which maintenance will be performed | |
# Hosts/FQDNs must have 1 listed per line for the script to execute properly | |
# run-updates script must be on target boxes and included in the PATH for the root user | |
# Checking if screen is installed. If not, apt will install it. | |
if [[ $(which screen) != "/usr/bin/screen" ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Created by Jeffery Grantham 01/04/2019 | |
# The purpose of this script is to reattach all open screens in sequential order. | |
# As you exit a screen, you will be automatically attached to the next open screen. | |
for line in `screen -ls | grep Detached | awk '{print $1}'` | |
do `screen -r $line` | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Created by Jeffery Grantham 01/07/2019 | |
# Purpose: Easily implement 301 redirects into website conf files | |
# Written for use with apache only | |
# Usage: 301.sh [.conf file] | |
FILE=$1 | |
cd /etc/apache2/sites-available/ | |
sed "/CustomLog/a\ \tRedirect 301 / https://$FILE.com/" $FILE.conf> tempfile && mv tempfile $FILE.conf | |
cat $FILE.conf |
NewerOlder