From 6c7d60c00f31f441678da85bc1ea34edbc9505ee Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 12 Nov 2019 11:06:20 -0600 Subject: [PATCH] Some things - moonscript for shell scripting is pretty neat --- apps/git/config | 1 + bin/remote | 17 +++++++++++++++++ bin/screenshot | 6 +++--- .../arch-linux/provisioning/2-essentials.bash | 6 +++++- scripts/arch-linux/provisioning/3-extras.bash | 2 ++ shell/bash/aliases | 4 ++++ 6 files changed, 32 insertions(+), 4 deletions(-) create mode 100755 bin/remote diff --git a/apps/git/config b/apps/git/config index f4343b7..e07c8ac 100644 --- a/apps/git/config +++ b/apps/git/config @@ -34,6 +34,7 @@ p = push pl = pull pf = push --force-with-lease + a = add -A [merge] tool = nvimdiff diff --git a/bin/remote b/bin/remote new file mode 100755 index 0000000..48cff38 --- /dev/null +++ b/bin/remote @@ -0,0 +1,17 @@ +#!/usr/bin/env moon + +require('fun')! + +garg = (v, i) -> os.getenv(v[1]) or arg[i] or v[2] +target, fwd, mpr, sargs, margs = unpack totable map garg, iter { + {"REMOTE_MACHINE", "remote"} + {"SSH_FORWARD_PORTS", "1313,3000,8000,8080,1234,40080:80,40443:443"} + {"MOSH_PORT_RANGE", "60000:61000"} + {"SSH_ARGS", "-XY"} + {"MOSH_ARGS", ""} +} + +sfwd = fwd\gsub "(%d+):?(%d*),?", (p, mp) -> + "-L #{p}:localhost:#{if mp == "" then p else mp} " + +os.execute "mosh -p '#{mpr}' '#{target}' --ssh='ssh #{sfwd} #{sargs}' #{margs}" diff --git a/bin/screenshot b/bin/screenshot index 9edec4b..54d11d3 100755 --- a/bin/screenshot +++ b/bin/screenshot @@ -1,6 +1,6 @@ #!/usr/bin/env bash -SCROT_DIR="$NICE_HOME/img/scrots/" -mkdir -p "$SCROT_DIR" -FILENAME="$NICE_HOME/img/scrots/%Y-%m-%d_%H-%M-%S_\$wx\$h.png" +SCROT_DIR="$NICE_HOME/img/scrots" +mkdir -p "$SCROT_DIR/" +FILENAME="$SCROT_DIR/%Y-%m-%d_%H-%M-%S_\$wx\$h.png" scrot "$@" "${FILENAME}" >/dev/null && echo "Saved screenshot to: ${FILENAME}" diff --git a/scripts/arch-linux/provisioning/2-essentials.bash b/scripts/arch-linux/provisioning/2-essentials.bash index c1d12ae..e7dd9a0 100755 --- a/scripts/arch-linux/provisioning/2-essentials.bash +++ b/scripts/arch-linux/provisioning/2-essentials.bash @@ -8,6 +8,7 @@ pacaur --needed -S \ rofi `# Application Launcher` \ ripgrep `# Code Search Utilities` \ fd `# File Search` \ + sd `# Easy Find/Replace` \ fzf `# Fuzzy File Finder` \ htop `# Process Management and System Resources Monitoring` \ openssh mosh `# Remote Access` \ @@ -47,9 +48,12 @@ pacaur --needed -S \ python-neovim python-jedi python-mistune python-psutil python-setproctitle httpie `# httpie and neovim dependencies` \ docker docker-compose `# Yummy containers` \ inotify-tools `# Watching` \ - zathura zathura-pdf-mupdf `# Document Viewer` \ + luajit lua luarocks `# Lua` \ --noconfirm --noedit # install rxvt-unicode script for resizing font on-the-fly mkdir -p "$HOME/.urxvt/ext" curl -L -o "$HOME/.urxvt/ext/resize-font" https://raw.githubusercontent.com/lytedev/urxvt-resize-font/master/resize-font + +# helpful Lua libs +<<< "fun moonscript lpeg alt-getopt luafilesystem" tr ' ' "\n" | xargs -I % sudo luarocks install % diff --git a/scripts/arch-linux/provisioning/3-extras.bash b/scripts/arch-linux/provisioning/3-extras.bash index a59b8f5..fd90db4 100755 --- a/scripts/arch-linux/provisioning/3-extras.bash +++ b/scripts/arch-linux/provisioning/3-extras.bash @@ -43,4 +43,6 @@ pacaur --needed -S \ redshift `# Save Your Eyes` \ vlc `# Video Viewer` \ ncdu `# Disk Usage Analyzer` \ + zathura zathura-pdf-mupdf `# Document Viewer` \ + scrot `# Screenshot Tool` \ --noconfirm --noedit diff --git a/shell/bash/aliases b/shell/bash/aliases index cf89274..6121514 100644 --- a/shell/bash/aliases +++ b/shell/bash/aliases @@ -103,6 +103,10 @@ alias C="clear && clear" alias r="ranger" alias rn="/usr/bin/watch -n 1" alias sctl="sudo systemctl" +alias sctlu="systemctl --user" +alias logs="sudo journalctl" +alias logsr="sudo journalctl -r" +alias logsf="sudo journalctl -f" alias btctl="sudo bluetoothctl" alias pt="htop -t" # experimental htop tree-view-by-default alias resrc="source \$HOME/.bashrc"