summaryrefslogtreecommitdiffstats
path: root/krebs/2configs/reaktor2.nix
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/2configs/reaktor2.nix')
-rw-r--r--krebs/2configs/reaktor2.nix57
1 files changed, 32 insertions, 25 deletions
diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix
index 0ea1ab2fa..3e88c0899 100644
--- a/krebs/2configs/reaktor2.nix
+++ b/krebs/2configs/reaktor2.nix
@@ -51,6 +51,29 @@ let
};
};
+ confuse = {
+ pattern = "^!confuse (.*)$";
+ activate = "match";
+ arguments = [1];
+ command = {
+ filename = pkgs.writeDash "confuse" ''
+ set -efu
+ export PATH=${makeBinPath [
+ pkgs.coreutils
+ pkgs.curl
+ pkgs.gnused
+ pkgs.stable-generate
+ ]}
+ stable_url=$(stable-generate "$@")
+ paste_url=$(curl -Ss "$stable_url" |
+ curl -Ss https://p.krebsco.de --data-binary @- |
+ tail -1
+ )
+ echo "$_from: $paste_url"
+ '';
+ };
+ };
+
taskRcFile = builtins.toFile "taskrc" ''
confirmation=no
'';
@@ -203,6 +226,12 @@ let
osm-restaurants = pkgs.callPackage "${osm-restaurants-src}/osm-restaurants" {};
in pkgs.writeDash "krebsfood" ''
set -efu
+ export PATH=${makeBinPath [
+ osm-restaurants
+ pkgs.coreutils
+ pkgs.curl
+ pkgs.jq
+ ]}
poi=$(curl -fsS http://c.r/poi.json | jq --arg name "$1" '.[$name]')
if [ "$poi" = null ]; then
latitude=52.51252
@@ -212,34 +241,12 @@ let
longitude=$(echo "$poi" | jq -r .longitude)
fi
- ${osm-restaurants}/bin/osm-restaurants --radius "$2" --latitude "$latitude" --longitude "$longitude" \
- | ${pkgs.jq}/bin/jq -r '"How about \(.tags.name) (https://www.openstreetmap.org/\(.type)/\(.id)), open \(.tags.opening_hours)?"'
- '
- '';
- };
- }
- {
- pattern = ''^([\H-]*?):?\s+([+-][1-9][0-9]*)\s+(\S+)$'';
- activate = "match";
- arguments = [1 2 3];
- command = {
- env = {
- # TODO; get state as argument
- state_file = "${stateDir}/ledger";
- };
- filename = pkgs.writeDash "ledger-add" ''
- set -x
- tonick=$1
- amt=$2
- unit=$3
- printf '%s\n %s %d %s\n %s %d %s\n' "$(date -Id)" "$tonick" "$amt" "$unit" "$_from" "$(expr 0 - "''${amt#+}")" "$unit" >> $state_file
- ${pkgs.hledger}/bin/hledger -f $state_file bal -N -O csv \
- | ${pkgs.coreutils}/bin/tail +2 \
- | ${pkgs.miller}/bin/mlr --icsv --opprint cat \
- | ${pkgs.gnugrep}/bin/grep "$_from"
+ osm-restaurants --radius "$2" --latitude "$latitude" --longitude "$longitude" \
+ | jq -r '"How about \(.tags.name) (https://www.openstreetmap.org/\(.type)/\(.id)), open \(.tags.opening_hours)?"'
'';
};
}
+ confuse
bedger-add
bedger-balance
hooks.sed