mirror of
https://github.com/kmein/niveum
synced 2026-03-16 18:21:07 +01:00
Compare commits
3 Commits
cbb676bf00
...
5dccdfee83
| Author | SHA1 | Date | |
|---|---|---|---|
| 5dccdfee83 | |||
| 8420a2435d | |||
| ed732b3a65 |
24
.bin/browser
Executable file
24
.bin/browser
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Usage: browser
|
||||
# pipe html to a browser
|
||||
# e.g.
|
||||
# $ echo '<h1>hi mom!</h1>' | browser
|
||||
# $ ron -5 man/rip.5.ron | browser
|
||||
|
||||
if [ -t 0 ]; then
|
||||
if [ -n "$1" ]; then
|
||||
open $1
|
||||
else
|
||||
cat <<usage
|
||||
Usage: browser
|
||||
pipe html to a browser
|
||||
$ echo '<h1>hi mom!</h1>' | browser
|
||||
$ ron -5 man/rip.5.ron | browser
|
||||
usage
|
||||
fi
|
||||
else
|
||||
f="/tmp/browser.$RANDOM.html"
|
||||
cat /dev/stdin > $f
|
||||
xdg-open $f
|
||||
fi
|
||||
34
.bin/horoscope.sh
Normal file
34
.bin/horoscope.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
set -efu
|
||||
|
||||
# Berlin: -d lodeg=13 -d lomin=22 -d losec=41 -d lodir=E -d ladeg=52 -d lamin=27 -d lasec=42 -d ladir=N -d usecoords=1 \
|
||||
# Kassel: -d lodeg=9 -d lomin=32 -d losec=5 -d lodir=E -d ladeg=51 -d lamin=18 -d lasec=17 -d ladir=N -d usecoords=1 \
|
||||
|
||||
|
||||
[ $# -eq 1 ] || {
|
||||
echo >&2 Usage: "$0" TIMESTAMP
|
||||
exit 1
|
||||
}
|
||||
|
||||
export TZ=UTC
|
||||
|
||||
chart_path="$(mktemp /tmp/chart_XXX.pdf)"
|
||||
|
||||
timestamp="$1"
|
||||
|
||||
year="$(date -d "@$timestamp" +%Y)"
|
||||
month="$(date -d "@$timestamp" +%m)"
|
||||
day="$(date -d "@$timestamp" +%d)"
|
||||
hour="$(date -d "@$timestamp" +%H)"
|
||||
minute="$(date -d "@$timestamp" +%M)"
|
||||
|
||||
curl -sSL 'https://edifyingfellowship.org/astro/' \
|
||||
-d lodeg=9 -d lomin=32 -d losec=5 -d lodir=E -d ladeg=51 -d lamin=18 -d lasec=17 -d ladir=N -d usecoords=1 \
|
||||
-d ybyr="$year" -d ybmo="$month" -d ybdy="$day" -d ybhr="$hour" -d ybmi="$minute" -d ybsc=0 -d ybtz="$TZ" \
|
||||
-d currenttime=0 \
|
||||
-d title="$timestamp" \
|
||||
-d options[]=VancouverWheel -d options[]=Arrow -d options[]=XBold -d options[]=HouseLabels -d options[]=Placidus \
|
||||
-d options[]=Sun -d options[]=Moon -d options[]=Mercury -d options[]=Venus -d options[]=Mars -d options[]=Jupiter -d options[]=Saturn -d options[]=Uranus -d options[]=Neptune -d options[]=Pluto -d options[]=Ascendant -d options[]=MC -d options[]=Lilith -d options[]=MeanNode -d options[]=TrueNode \
|
||||
-d aspectpct=100 -d format=PDF -d Submit= -o "$chart_path"
|
||||
|
||||
zathura "$chart_path"
|
||||
3
.bin/mail-current-part
Executable file
3
.bin/mail-current-part
Executable file
@@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
set -efu
|
||||
exec curl -fSs --unix-socket /tmp/much.api.sock http://localhost/current/part
|
||||
3
.bin/mail-current-query
Executable file
3
.bin/mail-current-query
Executable file
@@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
set -efu
|
||||
exec curl -fSs --unix-socket /tmp/much.api.sock http://localhost/current/query
|
||||
27
.bin/mail-current-query-find-part-by-name
Executable file
27
.bin/mail-current-query-find-part-by-name
Executable file
@@ -0,0 +1,27 @@
|
||||
#! /bin/sh
|
||||
# usage: mail-current-query-find-part-by-name NAME
|
||||
set -efu
|
||||
|
||||
name=$1
|
||||
|
||||
query=$(mail-current-query)
|
||||
result=$(notmuch show --entire-thread=false --format=json "$query")
|
||||
|
||||
part_id=$(printf %s "$result" | jq --arg name "$name" '
|
||||
[
|
||||
recurse |
|
||||
select(type == "object") |
|
||||
{ id, name: .filename } |
|
||||
select(.id != null and .name != null)
|
||||
] |
|
||||
map(select(.name == $name))[0].id
|
||||
')
|
||||
|
||||
if test "$part_id" = null; then
|
||||
printf 'error: could not find part with name %s\n' \
|
||||
"$name" \
|
||||
>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec notmuch show --part="$part_id" "$query"
|
||||
39
.bin/mail-current-query-find-part-by-type
Executable file
39
.bin/mail-current-query-find-part-by-type
Executable file
@@ -0,0 +1,39 @@
|
||||
#! /bin/sh
|
||||
# usage: mail-current-query-find-part-by-type TYPE
|
||||
set -efu
|
||||
|
||||
type=$1
|
||||
|
||||
query=$(mail-current-query)
|
||||
result=$(notmuch show --entire-thread=false --format=json "$query")
|
||||
|
||||
part_id=$(printf %s "$result" | jq --arg type "$type" '
|
||||
#flatten|map(select(.!=null))[0].body[0] |
|
||||
#
|
||||
#if .["content-type"] == $type then
|
||||
# .id
|
||||
#elif .["content-type"] | test("^multipart/") then
|
||||
# .content|map(select(.["content-type"]==$type))[0].id
|
||||
#else
|
||||
# null
|
||||
#end
|
||||
|
||||
[
|
||||
recurse |
|
||||
select(type == "object") |
|
||||
{ id, type: .["content-type"] } |
|
||||
select(.id != null and .type != null)
|
||||
] |
|
||||
map(select(.type == $type))[0].id
|
||||
')
|
||||
|
||||
if test "$part_id" = null; then
|
||||
printf 'error: could not find part with type %s\n' \
|
||||
"$type" \
|
||||
>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec notmuch show --part="$part_id" "$query"
|
||||
|
||||
|
||||
47
.bin/mail-reply
Executable file
47
.bin/mail-reply
Executable file
@@ -0,0 +1,47 @@
|
||||
#! /bin/sh
|
||||
set -efu
|
||||
|
||||
reply_to=$(mail-current-query)
|
||||
|
||||
if ! test "$(notmuch search --output=messages "$reply_to" | wc -l)" = 1; then
|
||||
echo "current query doesn't point to exactly one message. abort." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO update headers
|
||||
|
||||
notmuch reply "$reply_to" |
|
||||
sed '
|
||||
/^Non-text part: /d
|
||||
/^Attachment: /d
|
||||
' |
|
||||
jq -Rrs '
|
||||
# TODO dedup with mail-send
|
||||
split("\n") |
|
||||
index("") as $i |
|
||||
.[:$i] as $head |
|
||||
.[$i:] as $body |
|
||||
|
||||
{
|
||||
"MIME-Version": "1.0",
|
||||
"Content-Type": "text/plain; charset=UTF-8; format=flowed",
|
||||
"Content-Transfer-Encoding": "8bit"
|
||||
} as $extra_head |
|
||||
|
||||
($extra_head | keys | join("|")) as $extra_head_regex |
|
||||
($extra_head | to_entries | map("\(.key): \(.value)")) as $extra_head_lines |
|
||||
|
||||
# TODO each of these could be followed by multiple lines starting with spaces
|
||||
($head | map(select(test("^(\($extra_head_regex)):";"i") | not))) as $head |
|
||||
|
||||
($head + $extra_head_lines) as $head |
|
||||
|
||||
($head + $body) | join("\n")
|
||||
'
|
||||
|
||||
|
||||
# TODO fix From:
|
||||
# TODO tune quote
|
||||
|
||||
# TODO write draft
|
||||
# TODO send mail
|
||||
2
.bin/playlist_entries.sh
Executable file
2
.bin/playlist_entries.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
youtube-dl -ij "$*" | jq -sr '.[] | .webpage_url'
|
||||
4
.bin/readme
Executable file
4
.bin/readme
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
curl -sSL "https://raw.githubusercontent.com/$*/master/README.md" \
|
||||
| pandoc -f gfm -t man -s \
|
||||
| man -l -
|
||||
1
.bin/rfc.sh
Normal file
1
.bin/rfc.sh
Normal file
@@ -0,0 +1 @@
|
||||
curl -sSL "https://tools.ietf.org/rfc/rfc$*.txt" | less
|
||||
@@ -35,20 +35,6 @@ let
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
name = "myengadin-bridge";
|
||||
enable = true;
|
||||
inout = [
|
||||
{
|
||||
account = "irc.freenode";
|
||||
channel = "##myengadin";
|
||||
}
|
||||
{
|
||||
account = "telegram.kmein";
|
||||
channel = "-425759153";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
in
|
||||
|
||||
@@ -5,22 +5,41 @@ send_irc() {
|
||||
USER $USER $(hostname) tolmoon $USER
|
||||
NICK musikkritiker
|
||||
JOIN #the_playlist
|
||||
PRIVMSG #the_playlist $*
|
||||
PRIVMSG #the_playlist :$*
|
||||
QUIT
|
||||
" | nc irc.freenode.net 6667 >/dev/null
|
||||
}
|
||||
|
||||
good="what a banger
|
||||
ooh i love this song
|
||||
this is top notch stuff!
|
||||
nice!
|
||||
noice!
|
||||
yesss!
|
||||
cool song!
|
||||
i like this
|
||||
that just sounds awesome!
|
||||
that's a good song!
|
||||
👍"
|
||||
|
||||
bad="how can anyone listen to this?
|
||||
(╯°□°)╯ ┻━┻
|
||||
skip this!
|
||||
next, please! i'm suffering!
|
||||
that's just bad music
|
||||
nope
|
||||
that sucks!
|
||||
👎"
|
||||
|
||||
endpoint=prism.r:8001
|
||||
|
||||
case "$1" in
|
||||
good|like|cool|nice|yes|+)
|
||||
send_irc 'nice!' &
|
||||
good|like|cool|nice|noice|top|yass|yes|+)
|
||||
send_irc "$(echo "$good" | shuf -n1)" &
|
||||
curl -sS -XPOST "$endpoint/good"
|
||||
;;
|
||||
skip|next|bad|sucks|no|nope|-)
|
||||
send_irc 'sucks' &
|
||||
skip|next|bad|sucks|no|nope|flop|-)
|
||||
send_irc "$(echo "$bad" | shuf -n1)" &
|
||||
curl -sS -XPOST "$endpoint/skip"
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user