From bed170dd8a8ca5ba4c9109fc858dc658f90df68c Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Jun 2020 10:31:17 +0200 Subject: pkgs.kpaste: paste either stdin or file from parameter --- krebs/5pkgs/simple/kpaste/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/kpaste/default.nix b/krebs/5pkgs/simple/kpaste/default.nix index 217cb8a44..02f482316 100644 --- a/krebs/5pkgs/simple/kpaste/default.nix +++ b/krebs/5pkgs/simple/kpaste/default.nix @@ -1,6 +1,6 @@ { curl, gnused, writeDashBin }: writeDashBin "kpaste" '' - ${curl}/bin/curl -sS http://p.r --data-binary @- | - ${gnused}/bin/sed '$ {p;s/\/krebsco.de/}' + ${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" | + ${gnused}/bin/sed '$ {p;s/\/krebsco.de/}' '' -- cgit v1.2.3 From 360e823a9a187dd61d1c7f3f712a8edc9e7879d9 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 5 Jun 2020 10:39:43 +0200 Subject: pkgs.kpaste: replace internal host with https external host --- krebs/5pkgs/simple/kpaste/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/kpaste/default.nix b/krebs/5pkgs/simple/kpaste/default.nix index 02f482316..9820c931d 100644 --- a/krebs/5pkgs/simple/kpaste/default.nix +++ b/krebs/5pkgs/simple/kpaste/default.nix @@ -2,5 +2,5 @@ writeDashBin "kpaste" '' ${curl}/bin/curl -sS http://p.r --data-binary @"''${1:--}" | - ${gnused}/bin/sed '$ {p;s/\/krebsco.de/}' + ${gnused}/bin/sed '$ {p;s|http://p.r|https://p.krebsco.de|}' '' -- cgit v1.2.3 From bde301139df5474a72f79122f81feab1d6387a07 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 16 Jun 2020 19:58:40 +0200 Subject: fzfmenu: move to krebs --- krebs/5pkgs/simple/fzfmenu/default.nix | 55 ++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 krebs/5pkgs/simple/fzfmenu/default.nix (limited to 'krebs/5pkgs') diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix new file mode 100644 index 000000000..64e95d233 --- /dev/null +++ b/krebs/5pkgs/simple/fzfmenu/default.nix @@ -0,0 +1,55 @@ +{ pkgs, ... }: + +pkgs.writeDashBin "fzfmenu" '' + set -efu + PROMPT=">" + for i in "$@" + do + case $i in + -p) + PROMPT="$2" + shift + shift + break + ;; + -l) + # no reason to filter number of lines + LINES="$2" + shift + shift + break + ;; + -i) + # we do this anyway + shift + break + ;; + *) + echo "Unknown option $1" >&2 + shift + ;; + esac + done + INPUT=$(${pkgs.coreutils}/bin/cat) + OUTPUT="$(${pkgs.coreutils}/bin/mktemp)" + if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell + ${pkgs.rxvt_unicode}/bin/urxvt \ + -name fzfmenu -title fzfmenu \ + -e ${pkgs.dash}/bin/dash -c \ + "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ + --history=/dev/null \ + --print-query \ + --prompt=\"$PROMPT\" \ + --reverse \ + > \"$OUTPUT\"" 2>/dev/null + else + echo "$INPUT" | ${pkgs.fzf}/bin/fzf \ + --history=/dev/null \ + --print-query \ + --prompt="$PROMPT" \ + --reverse \ + > "$OUTPUT" + fi + ${pkgs.coreutils}/bin/tail -1 "$OUTPUT" + ${pkgs.coreutils}/bin/rm "$OUTPUT" +'' -- cgit v1.2.3