summaryrefslogtreecommitdiff
path: root/topics/deploy/useful-shell-scripts.gmi
diff options
context:
space:
mode:
authorPjotr Prins2023-12-03 09:47:38 -0600
committerPjotr Prins2023-12-03 09:47:38 -0600
commitbaeafc5ccc4a9893d22e6629db97720e3fa6d3ae (patch)
tree3701e477b4643893fbb33495ef64a758bba03de9 /topics/deploy/useful-shell-scripts.gmi
parentaa3d310aa257f0ef0a8636272883c3c4e6855a1c (diff)
downloadgn-gemtext-baeafc5ccc4a9893d22e6629db97720e3fa6d3ae.tar.gz
Rename/move
Diffstat (limited to 'topics/deploy/useful-shell-scripts.gmi')
-rw-r--r--topics/deploy/useful-shell-scripts.gmi52
1 files changed, 52 insertions, 0 deletions
diff --git a/topics/deploy/useful-shell-scripts.gmi b/topics/deploy/useful-shell-scripts.gmi
new file mode 100644
index 0000000..908928e
--- /dev/null
+++ b/topics/deploy/useful-shell-scripts.gmi
@@ -0,0 +1,52 @@
+# Useful Shell Scripts
+
+I make it a habit to put all my user-scripts in `~/bin/' and add that to my `$PATH'. Another useful tip is to prepend all my scripts using a "," - this allows me to quickly take advantage of zsh's autocomplete. For the curious, you could also adopt quiuy as part of the scripts - it has the advantage of adding more semantic meaning to your scripts.
+
+Most of these scripts were borrowed from:
+
+=> https://git.sr.ht/~whereiseveryone/dot/tree/master/item/bin
+
+Here are the scripts that make me more efficient on the terminal:
+
+* Run a script in the context of a directory: ",run-with-dir"
+
+```
+#!/bin/sh
+set -eo pipefail
+
+# Run a command in specific directory
+run_within_dir() {
+ target_dir="$1"
+ previous_dir=$(pwd)
+ shift
+ cd $target_dir && "$@"
+ cd $previous_dir
+}
+
+run_within_dir $@
+```
+
+If you are in `$HOME', you can do something like: "run-within-dir /tmp"
+
+* Choose a guix profile on the fly: ",choose-profile":
+
+```
+#!/bin/env sh
+
+# To run this use source!
+
+GUIX_PROFILE="$(guix package --list-profiles | fzf --multi)"
+
+export GUIX_PROFILE
+. "$GUIX_PROFILE/etc/profile"
+```
+
+* Run magit from any terminal: ",magit". You can take of fzf's autocomplete
+
+```
+#!/bin/env sh
+
+emacsclient --eval "(projectile-vc \"$PWD/$@\")"
+```
+
+Should these scripts become too many, a repository will be created and a link added to point there.