From 87b63654a7a881afefddaeb6c3dbbf32105070bb Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 4 Jun 2021 16:43:08 +0200 Subject: update, add fv --- bin/fv | 6 ++++++ bin/update_hosts | 6 +++--- bin/vm | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100755 bin/fv diff --git a/bin/fv b/bin/fv new file mode 100755 index 0000000..5662ed3 --- /dev/null +++ b/bin/fv @@ -0,0 +1,6 @@ +#!/bin/sh +# quick file viewer +#exec fzf --multi --preview-window=right:66% --preview 'cat {1}' +exec fzf --ansi --multi --preview-window=right:75% \ + --bind=left:preview-page-up --bind=right:preview-page-down \ + --preview 'cat {1}' diff --git a/bin/update_hosts b/bin/update_hosts index 75c41d1..e7321bf 100755 --- a/bin/update_hosts +++ b/bin/update_hosts @@ -5,7 +5,7 @@ [ "$USER" = root ] || exec sudo "$0" "$@" -echo "Check from https://github.com/StevenBlack/hosts" +echo "Checking from https://github.com/StevenBlack/hosts:" lsd=$(curl -s "https://api.github.com/repos/StevenBlack/hosts/commits?path=hosts&page=1&per_page=1"| jq -r '.[0].commit.committer.date') echo "last source update: $(date -j -f "%FT%TZ" "$lsd")" echo "last local update: $(date -r /etc/hosts)" @@ -14,7 +14,7 @@ echo "last local update: $(date -r /etc/hosts)" cd /etc cp -p hosts hosts.old hosts=$(awk '/^# Custom host /, /^# End of custom host /' hosts.old) -curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' +curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | awk ' BEGIN { hosts = ARGV[1]; ARGV[1] = "" } /^# Custom host / { print hosts; next } /^# End of custom host / { next } @@ -22,5 +22,5 @@ curl -s 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts' | aw ' "$hosts" > hosts.new mv hosts.new hosts -[ "$(uname -s)" != Darwin ] || dscacheutil -flushcache +[ "$(uname -s)" != Darwin ] || { dscacheutil -flushcache; killall -HUP mDNSResponder; } diff -u /etc/hosts.old /etc/hosts | diffstat diff --git a/bin/vm b/bin/vm index b0e1303..732ba49 100755 --- a/bin/vm +++ b/bin/vm @@ -179,7 +179,7 @@ $(isoinfo): init_alpine() { mkdir -p "$dir/alpine-iso" && cd "$dir/alpine-iso" || die 'init alpine failed' - [ -f 'Makefile' ] || printf "%s" "$alpine_makefile" > Makefile + [ -f 'Makefile' ] || printf '%s' "$alpine_makefile" > Makefile make -s all } -- cgit v1.2.3