From 5da918119bb2e352f10060a36d9c7e580fa8695e Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Wed, 16 Jul 2025 14:29:56 -0400 Subject: prep for js version --- .dir-locals.el | 7 +++++++ .envrc | 1 + Makefile | 2 ++ README.org | 6 +++--- pairwise.pl | 8 ++++++-- shell.nix | 13 +++++++++++++ 6 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 .dir-locals.el create mode 100644 .envrc create mode 100644 Makefile create mode 100644 shell.nix diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..55b82b2 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,7 @@ +;;; Directory Local Variables -*- no-byte-compile: t -*- +;;; For more information see (info "(emacs) Directory Variables") + +((nil . ((compile-command . "make serve"))) + (js-base-mode . ((js-indent-level . 4) + (js-chain-indent . t) + (js-indent-first-init . dynamic)))) diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..aedafd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +serve: + python -m http.server 31337 diff --git a/README.org b/README.org index 8fb8941..541ab45 100644 --- a/README.org +++ b/README.org @@ -40,12 +40,12 @@ or, in csv: * runners #+name: process -#+begin_src shell :results file :file n-401-94.csv :var threshold=94.0 filename="inputs/n-401.csv" - guix shell perl -- ./pairwise.pl $threshold $filename +#+begin_src shell :results file :file paplcv-nov-16-2024-aligned_mat-90.5.csv :var threshold=90.5 filename="inputs/PapLCV-Nov-16-2024-Aligned_mat.csv" + nix-shell --run "./pairwise.pl $threshold $filename" #+end_src #+RESULTS: process -[[file:n-401-94.csv]] +[[file:paplcv-nov-16-2024-aligned_mat-90.5.csv]] #+call: process[:file n-402-90.5.csv](threshold=90.5, filename="n-402.csv") diff --git a/pairwise.pl b/pairwise.pl index f721575..693b664 100755 --- a/pairwise.pl +++ b/pairwise.pl @@ -3,6 +3,8 @@ use strict; use warnings; +use Scalar::Util qw(looks_like_number); + die "usage: $0 threshold file […]\n" unless $#ARGV > 0; my $threshold = shift; @@ -14,9 +16,11 @@ while (<>) { chomp; my @parts = split /,/; for (my $i=1; $i <= $#headers; $i++) { - if (defined $parts[$i]) { + if (defined $parts[$i] && looks_like_number($parts[$i])) { + # print STDERR "#h: $#headers #p: $#parts\n"; + # print STDERR "parts: @parts\n"; my $similarity = $parts[$i]; - print "$parts[0],$headers[$i]\n" if $similarity >= $threshold; + print "$parts[0],$headers[$i]\n" if $similarity > $threshold; } } } diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0f5c343 --- /dev/null +++ b/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + packages = with pkgs; [ + perl + gnumake + python3 + typescript-language-server + vscode-langservers-extracted + ]; + + TMPDIR = "/tmp"; # lsp needs it +} -- cgit v1.3