summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2021-06-04 16:43:08 +0200
committerMarc Vertes <mvertes@free.fr>2021-06-04 16:43:08 +0200
commit87b63654a7a881afefddaeb6c3dbbf32105070bb (patch)
tree61d7018ed7eb6da484cdbda9d91edd67c82043a6
parent2dc5563129877c1aad571e2023a7e9cc8eec5d04 (diff)
update, add fv
-rwxr-xr-xbin/fv6
-rwxr-xr-xbin/update_hosts6
-rwxr-xr-xbin/vm2
3 files changed, 10 insertions, 4 deletions
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
}