Skip to content

Instantly share code, notes, and snippets.

@Landrash
Landrash / notes.sh
Created February 11, 2022 22:08
Simple notetaking script that creates a note in a folder with the current date and adds a timestamp when it's launched. Inspired by @maccan
# /bin/bash
##########################################################
### Simple notetaking script ###
### Creates notes in a folder based on date ###
### and add a timestamp into the file when it launched ###
##########################################################
#Variables
EDITOR="nano"
echo "Please take a moment to setup autorenewal of duckdns."
echo "If no choice is made the installation will exit."
echo
echo "(if your domain is 'example.duckdns.org' type example)"
echo -n "Domain: "
read -r domain
if [ ! "$domain" ]; then
exit
fi
if [[ $domain = *"duckdns"* ]]; then
@Landrash
Landrash / lovelace.yaml
Created March 6, 2019 20:52
Lovelace Landrash 20190306
views:
- path: default_view
icon: 'mdi:home'
title: Home
- type: horizontal-stack
badges: []
cards:
- type: vertical-stack
cards:
cards:
@Landrash
Landrash / updatedev.sh
Created January 24, 2019 22:46
zigbee2mqtt update script
#!/bin/bash -e
echo "Stopping zigbee2mqttdev..."
sudo systemctl stop zigbee2mqttdev
echo "Creating backup of configuration..."
cp -R data data-backup
echo "Updating..."
git pull
@Landrash
Landrash / zigbee2mqttdev.sh
Created January 24, 2019 22:43
Setup for development version of Zigbee2mqtt
#!/bin/bash
function zigbee2mqttdev-show-short-info {
echo "Setup for development version of Zigbee2mqtt."
}
function zigbee2mqttdev-show-long-info {
echo "This script installs the development version of Zigbee2mqtt."
}
function zigbee2mqttdev-show-copyright-info {
#!/bin/bash
function find3cli-show-short-info {
echo "Setup for find3-cli. "
}
function find3cli-show-long-info {
echo "This script installs find3-cli."
}
function find3cli-show-copyright-info {
@Landrash
Landrash / skip.sh
Last active February 9, 2018 18:59
Quick SKIP script for the hassbian pi-gen script.
#!/bin/bash
if [ -f pi-gen/stage0/SKIP ]; then
echo "SKIP file found. Removing SKIP files"
sudo rm pi-gen/stage0/SKIP
sudo rm pi-gen/stage1/SKIP
sudo rm pi-gen/stage2/SKIP
exit
else
echo "No SKIP file found. Creating SKIP files."
@Landrash
Landrash / ICND1Discovery10.yaml
Last active February 7, 2018 15:55
ICND1Discovery10.yaml
diagram:
fill: "snow"
rows: 5
columns: 12
gridLines: false
gridPaddingInner: .25
groupPadding: .75
title:
author: Fredrik Lindqvist
@Landrash
Landrash / HowToOTGFast.md
Created January 9, 2018 21:04 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@Landrash
Landrash / HowToOTG.md
Created January 9, 2018 20:57 — forked from gbaman/HowToOTG.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero

Raspberry Pi Zero OTG Mode

Simple guide for setting up OTG modes on the Raspberry Pi Zero - By Andrew Mulholland (gbaman).

The Raspberry Pi Zero (and model A and A+) support USB On The Go, given the processor is connected directly to the USB port, unlike on the B, B+ or Pi 2 B, which goes via a USB hub.
Because of this, if setup to, the Pi can act as a USB slave instead, providing virtual serial (a terminal), virtual ethernet, virtual mass storage device (pendrive) or even other virtual devices like HID, MIDI, or act as a virtual webcam!
It is important to note that, although the model A and A+ can support being a USB slave, they are missing the ID pin (is tied to ground internally) so are unable to dynamically switch between USB master/slave mode. As such, they default to USB master mode. There is no easy way to change this right now.
It is also important to note, that a USB to UART serial adapter is not needed for any of these guides, as may be documented elsewhere across the int