Skip to content

Instantly share code, notes, and snippets.

@hraftery
hraftery / Alphametics.hs
Created November 10, 2021 03:00
My Haskell solution to the "Alphametics" challenge at https://exercism.org/tracks/haskell/exercises/alphametics
module Alphametics (solve) where
import Data.Char (isSpace)
import Data.List (nub, intersect, transpose, elemIndex)
import Data.Maybe (fromJust)
solve :: String -> Maybe [(Char, Int)]
solve input = if length solutions == 1 then Just $ zip charMap (head solutions) else Nothing
where
toRowsOfChars = wordsBy "+=" -- create list of words from input (["SEND","MORE","MONEY"])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hraftery
hraftery / Install_QuestDB_On_FreeBSD.md
Last active January 22, 2023 10:08
Instructions on not just downloading and running QuestDB on FreeBSD, but putting the requirements elements in a sensible location and configuring it to run on boot.

There does not seem to be any guidance available for installing QuestDB on FreeBSD. An enquiry on Slack created helpful suggestions, but nothing directly actionable.

For posteriority I decided to create my own installer. This seems to do the trick, and is modelling on the Homebrew configuration, for lack of a better idea.

As root:

pkg install bash
curl -LO https://github.com/questdb/questdb/releases/download/6.0.4/questdb-6.0.4-rt-freebsd-amd64.tar.gz
tar xvf questdb-6.0.4-rt-freebsd-amd64.tar.gz
cd questdb-6.0.4-rt-freebsd-amd64
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hraftery
hraftery / merge_roam_daily.pl
Created April 18, 2021 09:28
Merge all the daily pages from Roam Research into one markdown file with date headings
#!/usr/bin/perl -w
use Time::Piece;
%dailies = ();
foreach my $daily (<*.md>)
{
my $fn = $daily; #store original for use later
@hraftery
hraftery / Installing_nRF_Connect_SDK_on_macos.md
Last active July 27, 2021 21:25
Installing nRF Connect SDK on macos

Installing nRF Connect SDK on macos

Conditions

  • Applicable to the nRF9160-DK and probably other platforms the SDK supports.
  • Correct as at 2021-04-07. Many fast moving parts so will likely age quickly.

Instructions