commit 2a955252e3104b568306d72b7f0b957df1c02106
parent e390e7c63dfea39520b826d7e7986445e9991602
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Tue, 31 Aug 2021 01:52:27 -0700
Add some useful scripts
These have been laying around for awhile and I think they are useful
enough to add here.
Diffstat:
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/local/bin/.local/bin/ac b/local/bin/.local/bin/ac
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copyright 2021 Jacob R. Edwards
+# License: GPLv3
+# ac -- Argument calculator
+
+printf '%s\n' "$@" | bc
diff --git a/local/bin/.local/bin/hd b/local/bin/.local/bin/hd
@@ -0,0 +1,16 @@
+#!/usr/bin/awk -f
+# Copyright 2021 Jacob R. Edwards
+# License: GPLv3
+# hd count [file ...]
+
+BEGIN {
+ if (match(ARGV[1], "[^0-9]")) {
+ print ARGV[1] ": Not a number." > "/dev/stderr";
+ exit 1;
+ }
+ count = int(ARGV[1]);
+ delete ARGV[1];
+}
+
+FNR > count { nextfile }
+1
diff --git a/local/bin/.local/bin/keysym b/local/bin/.local/bin/keysym
@@ -0,0 +1,6 @@
+#!/bin/sh
+# Copyright 2021 Jacob R. Edwards
+# License: GPLv3
+# keysym -- Display X keysyms
+
+xev | sed -En 's/[^(]*\(keysym[^,]*, ([^)]*).*/\1/p'