clojure

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).

Clojure Libraries in ODH

Intro The following is a copy of a blog post for our organization, originally posted at https://odh.byu.edu/blog/clojure-libraries-in-odh My work with The Office of Digital Humanities is as a senior web developer. My teams and I build applications in the Clojure programming language1 to serve the college of Humanities and the Office of Digital Humanities, and utility libraries that serve the university and the broader developer community. Here are a few of our heavily used utility libraries, which have been used internally for years.

SystemD devops run and restart services

Getting an app to redeploy as fixes and upgrades are uploaded to a linux server For most webapps I oversee it is desirable to have a mechanism in place not only for having them start when the server reboots, but also to restart the app when I need to deploy an update or (most recently) a fix to the application.1 This process requires sudo access2 and five files for a full redeployment system3:

project local PostGres on GUIX with Clojure JDBC (2022)

Intro 🖼1 There are several copy-pasted articles2 out there on setting up project-local postgres instances. Which one came first or whether they are both copies of another, I don’t know; but in any case, I found the goals good, and was enlightened by the concept. There are several technical errors, but they served to get the juices flowing. I am using the Postgres software version I got from GUIX, which is postgres 14.

Apache websocket setup

Intro The need was to make sure that our apache was able to communicate with our Sente1 Apache config To the apacheconfig, under the :443 section (https) # Trying websockets here, c/o RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://127.0.0.1:8080/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket [NC] RewriteRule /(.*) http://127.0.0.1:8080/$1 [P,L] # END websockets Server shell, enabling the apache modules /sudo:root@devflats:/ $> a2enmod proxy_wstunnel # Considering dependency proxy for proxy_wstunnel: # Module proxy already enabled # Enabling module proxy_wstunnel.

fast fibonacci in Clojure?

Intro A recent stack overflow question asked about Clojure performance compared to other implementations, with Python and raw java performing vastly better than Clojure1. Now, this is Clojure, so there must be a better way. One of the answers pointed to RosettaCode and Clojure fibonacci implementations there2, so I felt pretty good grabbing the “Doubling Algorithm (Fast)” version given there, which is based on an off-the-cuff github answer from Clojure optimization guru Mike Fikes3.

Two modes on loading a file

** This question was posted to the emacs stackexchange. 1 Clojure files should open in Clojure-mode. I also have Clojure files that contain color info and are used to generate my styles; they live under a /styles path. For these files, I want them to have both clojure-mode (a major mode) and rainbow-mode (a minor mode). I can implement this on a file-by-file basis be starting such files with a line like this:

Clojure in Action: Teaching new Clojure devs on our work applications

For reasons of internal review but also for the benefit of the community, at work I’ve started recording and making public some of our work meetings, where we build web applications using a full-stack Clojure setup derived (years ago) from Luminus. Several of our team members are brand new to Clojure, so we deal with lots of basics. Questions are welcome! https://www.youtube.com/playlist?list=PLRoUFLqvFD3MRYXTnXQyl-z_svY2gDhFi

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.

use different java version on your system

Some of my Clojure deployments are using our old deployment method, which uses immutant, but it’s deprecated and fails due to an old dependency requiring java 8-. So switch to java 18 like (assuming it’s installed) like this: sudo update-alternatives --config java Resources