bash

Re-Writing a GlobalProtect OpenConnect VPN Connect script in Babashka

** Edit 2023.001.17: fixed syntax errors CLI command in /usr/bin and username > user This is an update of a previous Babashka1 project2, changed because my organization has switched to a Palo Alto GlobalProtect VPN instead of our former Cisco one. Originally this posed a major problem for OpenConnect, which had troubles with GlobalProtect, but with wersion 9+ of OpenConnect it works smoothly (as long as your provider doesn’t require SAML authentication, which is apparently still buggy in OpenConnect 9).

Bash brace expansion for adding a quick suffix to a file name

Intro I am no Bash expert, but in searching for an unrelated answer I came across the following snippet to add a suffix to a file: sudo mv /usr/share/dbus-1/services/org.knopwob.dunst.service{,.disabled} The insight here was in the way the braces expanded to the full earlier path. I look forward to making better use of this in my command-line journeyings. I also found a nice instructive cheat sheet here: https://wiki.bash-hackers.org/syntax/expansion/brace .

Re-Writing an OpenConnect VPN Connect script in Babashka

This is the second of a 2-part series of articles.1 It was updated 2021.005.24 to add the :servercert option to the openconnect command. The sundries of just handling arguments and options2 was alone so annoying in Bash that I finally used it as an excuse to play with Babashka3, which I’ve been watching eagerly for quite a while. The script itself is small while providing niceties that would have taken much longer, and also more lines of code, to implement in Bash.

Writing an OpenConnect VPN Connect script in Bash

Bypassing proprietary GUI for VPN connection was a very productive idea, and using OpenConnect to replace the Cisco AnyConnect client which was continually breaking for me proved nice, and provided a nice1 command-line interface to make it scriptable. This is part of a series2 of articles because making something even as trivial as an API wrapper in Bash, gave me a mortifying glimpse of the antiquity of Bash. So after this article, check out the re-work in Babashka, a fast and much better designed interpreter that works as a shell script.

Quickly Creating DB namespaces with shell, emacs, and init.sql

My project design includes creating a file/namespace for each database table, with a suite of CRUD operations applying to each table. The end result is that I have functions like db.my-table/CREATE, READ, UPDATE, and DELETE available for each table. The strategy is as follows: Establish the template clj file that has all your CRUD operations Obtain all table names (e.g. from init.sql) Use a script to create a matching clj file based on template (1) customized to refer to the tables from (2) 1.

Useful shell scripts

Placing little scripts in your ~/bin directory makes it abundantly clear why some people love shell scripting, and some jobs require shelll scripting as a skill. It seriously improves the speed and ease of life. Here are a few that I enjoy: Crashplan Because I sometimes need to micromanage my backup software and the software doesn’t function if I try linking it to another folder this simplifies things. #!/bin/bash # file: /~/bin/crash CRASHPLAN_DIR=/usr/local/crashplan/bin cd $CRASHPLAN_DIR; sudo .