Skip to content

Instantly share code, notes, and snippets.

@darookee
darookee / rpass
Created August 18, 2016 07:50
generate random password (hex or alphanumeric)
#!/bin/bash
# generate a random password from /dev/urandom
# usage: rpass <pwlength> <number_of_passwords> <h for hex>
alnum="[:digit:][:alpha:]"
hex="a-f[:digit:]"
if [ "${3}" == "h" ]; then
pwtype=$hex
@darookee
darookee / Dockerfile
Created August 16, 2016 11:23
golem.de Mitmachprojekt: Dockerfile für die Verbindung von Homeassistant und golem.de
FROM tutum/curl
RUN curl -L \
https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 \
> /bin/jq && chmod +x /bin/jq
COPY run.sh /run.sh
CMD ["/run.sh"]
@darookee
darookee / mail.go
Created April 22, 2016 09:34
mail.go - test you mailserver sender restrictions (and other things) without the need of configuring a mail client, and without the hassle of a telnet-transaction...
package main
import (
"log"
"net/smtp"
"flag"
"fmt"
"os"
)
@darookee
darookee / mqtt_export.py
Created April 7, 2016 11:08
Export Home Assistant state changes to MQTT
"""
MQTT publisher for all Home Assistant states.
Copyright (c) 2016 Fabian Affolter <[email protected]>
Licensed under MIT
For questions and issues please use https://community.home-assistant.io
To use this component you will need to add something like the
following to your configuration.yaml file.
Verifying that +darookee is my blockchain ID. https://onename.com/darookee
@darookee
darookee / node-red-mysensors-mqtt-reqid.json
Last active February 5, 2016 22:18
MySensors Node-Red ID Manager
[{"id":"57cdcb97.a83234","type":"mqtt-broker","z":"bfd70105.4029","broker":"192.168.0.xx","port":"1883","clientid":"node-red","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willRetain":"false","willPayload":"","birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":""},{"id":"4cbd172d.b342e8","type":"mqtt in","z":"bfd70105.4029","name":"reqid","topic":"mysensors-out/255/255/3/0/3","broker":"57cdcb97.a83234","x":90,"y":577,"wires":[["61691499.9e96ec"]]},{"id":"2efa24d9.d105dc","type":"mqtt out","z":"bfd70105.4029","name":"setid","topic":"mysensors-in/255/255/3/0/4","qos":"0","retain":"","broker":"57cdcb97.a83234","x":1058,"y":586,"wires":[]},{"id":"355817e1.caa7e8","type":"function","z":"bfd70105.4029","name":"generate-mysensor-id","func":"var id, ids = [], idsA = msg.payload, idMsg = {};\n\n// convert array of objects\n// to array\nfor(var i=0; i<idsA.length; i++) {\n ids.push(idsA[i].id);\n}\n\n// generate unique id u
#!/bin/bash
# Requires zbackup
# zbackup-backups will not be encrypted (no password file)
# uses lftp to upload $BACKUPDIR contents to remote ftp
BACKUPDIR="/var/backups/"
FTPUSER=""
FTPPASS=""
@darookee
darookee / check_mailq.sh
Created January 21, 2016 21:06
Check for large mailq, stop postfix, send pusbullet notification
#!/bin/bash
mailsinqueue=$(mailq 2> /dev/null|egrep "^[A-Z0-9]{11}[[:space:]].*" -c)
if [ "$mailsinqueue" -gt "15" ]; then
postfix status 1&>2 > /dev/null || exit 0
postfix stop 1&>2 > /dev/null
echo "SPAM!" | /usr/bin/pb 2> /dev/null
exit 1
fi
@darookee
darookee / cron.d_letsencrypt
Last active January 21, 2016 21:05
Auto-Renew Let's Encrypt Certificates using `certonly`
30 2 * * 1 /usr/local/bin/renew-letsencrypt >> /var/log/le-renewal.log
@darookee
darookee / rpass.sh
Created November 3, 2015 14:25
Generate random passwords
#!/bin/bash
#
# Usage: ${0} <length> <count> <hex or alpha>
# Example: ${0} 12 1 h
# ${0} 32 2
# ${0}
alnum="[:digit:][:alpha:]"
hex="a-f[:digit:]"