Skip to content

Instantly share code, notes, and snippets.

View nilsreiter's full-sized avatar
🤩

Nils Reiter nilsreiter

🤩
View GitHub Profile
@nilsreiter
nilsreiter / nagging_alert_notification.yaml
Last active December 25, 2023 08:17 — forked from pavax/nagging_alert_notification.yaml
Home Assistant Alert Notification Blueprint
blueprint:
name: Nagging Alerting Notification Automation
description: >
Trigger an alert based on the state of a given sensor.
The Alert is send to a mobile app device and repeats as long as the sensor is in the given state.
An additonal action can be specified. This might be useful to tts the message.
domain: automation
source_url: https://gist.github.com/nilsreiter/3c54a5dfb84e2216a6599456ccbfa27d
input:
sensor_entity:
@nilsreiter
nilsreiter / script.yaml
Created October 8, 2023 09:56
This is a script I used in Home Assistant to distribute color palettes on participating lights.
alias: Light / Hue Scene
description: >-
This script tries to replicate the Hue scenes. Colors are distributed randomly
on participating lights. Each scene currently has five different colors
represented by XY values. The script is only applied to lights that support XY
color mode.
fields:
target:
name: Target
required: true
@nilsreiter
nilsreiter / data-handling.tex
Created June 11, 2018 11:20
How processing and data in QuaDramA are organized
\begin{tikzpicture}[node distance=70,every node/.style={draw,align=center,font=\small},
process/.style={rectangle, rounded corners}]
\node (tei) at (0,0) [cylinder, shape border rotate=90,shape aspect=.4] {TEI/XML\\in git\\repository\\};
\node (annotation) [process, right=1cm of tei] {Manual annotation};
\node (nlp) [process,below=1cm of tei] {DramaNLP (\texttt{Java})};
\node (csv) [below of=nlp,cylinder, shape border rotate=90,shape aspect=.4] {CSV\\in git\\repositories\\\texttt{data\_*}};
\node (r) [below of=csv,process] {DramaAnalysis (\texttt{R})};
\draw [->] (tei) -- (nlp);
\draw [->] (nlp) -- (csv);
@nilsreiter
nilsreiter / word-statistics.sh
Last active June 6, 2018 11:04
Count words in plain text file
# This snippet can be used on the command line (tested on a Mac) to get a quick list of word frequencies in the file FILENAME.
# Counting will be done case-insensivitely, i.e., differently cased words will be counted together.
# The result will be written in the file stats.csv (or any other that you give at the end) in the form of a space-separated table
cat FILENAME | tr '[[:punct:][:space:]]' '\n' | sort | uniq -ci | sort -nr | tail -n +2 > stats.csv
@nilsreiter
nilsreiter / fix-issues.sh
Last active May 4, 2018 11:17
Fixes some issues in some XML files
#!/bin/bash
# convert encoding to UTF-8
for i in $(ls *.xml); do iconv -f ISO-8859-1 -t UTF8 $i | sponge $i; done
sed -i .bak 's/ISO-8859-1/UTF-8/g' *.xml
# fix double amp s in the files
sed -i .bak 's/&/\&/g' *.xml
# convert regular & to their xml entities