diff options
Diffstat (limited to '.local/bin')
-rwxr-xr-x | .local/bin/dedup | 2 | ||||
-rwxr-xr-x | .local/bin/e | 2 | ||||
-rwxr-xr-x | .local/bin/http-dir | 29 | ||||
-rwxr-xr-x | .local/bin/p | 4 | ||||
-rwxr-xr-x | .local/bin/sh-prompt | 23 | ||||
-rwxr-xr-x | .local/bin/v | 5 |
6 files changed, 28 insertions, 37 deletions
diff --git a/.local/bin/dedup b/.local/bin/dedup index 912cb95..69913ce 100755 --- a/.local/bin/dedup +++ b/.local/bin/dedup @@ -1,3 +1,3 @@ #!/usr/bin/awk -f -!a[$0]++ +!seen[$0]++ diff --git a/.local/bin/e b/.local/bin/e index e341837..cab6db4 100755 --- a/.local/bin/e +++ b/.local/bin/e @@ -1,3 +1,3 @@ #!/bin/sh -- -exec "${EDITOR:-ed}" "$@" +"${EDITOR:-ed}" "$@" diff --git a/.local/bin/http-dir b/.local/bin/http-dir deleted file mode 100755 index a1dd19d..0000000 --- a/.local/bin/http-dir +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import http.server -import os -import sys - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--bind', '-b', metavar='ADDRESS',default='', help='specify alternate bind address (default: all interfaces)') - parser.add_argument('--directory', '-d', default=os.getcwd(), help='specify alternate directory (default: current directory)') - parser.add_argument('port', action='store', default=8000, type=int, - nargs='?', help='specify alternate port (default: 8000)') - args = parser.parse_args() - - class app(http.server.SimpleHTTPRequestHandler): - def __init__(self, request, client_address, server): - super().__init__(request, client_address, server, directory=args.directory) - - with http.server.ThreadingHTTPServer((args.bind, args.port), app) as httpd: - try: - httpd.serve_forever() - except KeyboardInterrupt: - sys.exit() - - - -if __name__ == '__main__': - main() diff --git a/.local/bin/p b/.local/bin/p index 3b2aef1..7951699 100755 --- a/.local/bin/p +++ b/.local/bin/p @@ -1,3 +1,3 @@ -#!/bin/sh -- +#!/bin/sh -- -exec "${PAGER:-less}" "$@" +"${PAGER:-more}" "$@" diff --git a/.local/bin/sh-prompt b/.local/bin/sh-prompt index ebc1057..389dd3c 100755 --- a/.local/bin/sh-prompt +++ b/.local/bin/sh-prompt @@ -1,3 +1,24 @@ #!/bin/sh -- -printf "%u %s@%s %s $ " "$1" "$(id -un)" "$(uname -n)" "$(pwd|sed 's|'"$HOME"'|~|g')" +( + save="$(stty -g)" + stty sane + tput sgr0 +# tput rmcup + if test "${VTE_VERSION:-0}" -ge 3405 + then + printf "\x1b]7;file://%s%s\x1b\\" "$(uname)" "$(pwd)" + fi + set-title "$(printf "%s@%s:%s" "$(id -un)" "$(uname -n)" "$(pwd|sed 's|'"$HOME"'|~|g')")" + stty "$save" +) > /dev/tty + +case "$(id -u)" in + 0) + PS='#' + ;; + *) + PS='$' +esac + +printf "%u %s@%s:%s %c " "$1" "$(id -un)" "$(uname -n)" "$(pwd -L|sed 's|'"$HOME"'|~|g')" "$PS" diff --git a/.local/bin/v b/.local/bin/v index 9a5f35f..0d79e15 100755 --- a/.local/bin/v +++ b/.local/bin/v @@ -1,4 +1,3 @@ -#!/bin/sh -- - -"${VISUAL:-${EDITOR:-vi}}" "$@" +#!/bin/sh +"${VISUAL:-vi}" "$@" |