Some things - moonscript for shell scripting is pretty neat

This commit is contained in:
Daniel Flanagan 2019-11-12 11:06:20 -06:00
parent 20500dd06b
commit 6c7d60c00f
6 changed files with 32 additions and 4 deletions

View file

@ -34,6 +34,7 @@
p = push
pl = pull
pf = push --force-with-lease
a = add -A
[merge]
tool = nvimdiff

17
bin/remote Executable file
View file

@ -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}"

View file

@ -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}"

View file

@ -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 %

View file

@ -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

View file

@ -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"