Skip to content

Instantly share code, notes, and snippets.

View nathaniel-may's full-sized avatar

Nathaniel May nathaniel-may

View GitHub Profile
@nathaniel-may
nathaniel-may / README.md
Last active January 24, 2024 00:08
Run Metabase jar as a service on Ubuntu
  1. sudo apt update && sudo apt install default-jre
  2. mkdir /opt/metabase
  3. cd wget -P /opt/metabase/ https://downloads.metabase.com/v0.48.3/metabase.jar (replace with latest version)
  4. create /etc/systemd/system/metabase.service and use the contents from below.
  5. cp /etc/systemd/system/metabase.service /lib/systemd/system/
  6. systemctl restart systemd-journald.service (restart the journal service to get a log file)
  7. systemctl edit metabase to create an override to provide environment variables:
### Editing /etc/systemd/system/metabase.service.d/override.conf
@nathaniel-may
nathaniel-may / Main.hs
Created March 25, 2023 23:08
Simple Type Unification Example
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, GeneralizedNewtypeDeriving #-}
module Main where
import Control.Monad(when)
import Control.Monad.Except
import Control.Monad.State
import Data.Foldable (traverse_, foldrM)
import Data.Functor (($>))
import Data.Map (Map)
@nathaniel-may
nathaniel-may / Cargo.toml
Last active December 1, 2022 15:02
A pattern for structured logging in Rust
[package]
name = "logging-gist"
version = "0.1.0"
edition = "2018"
[dependencies]
serde_json = "1.0"
chrono = "0.4"
@nathaniel-may
nathaniel-may / Sqrt.hs
Created January 22, 2022 18:19
sqrt calculations with the Newton–Raphson method
{-
Uses the Newton–Raphson method for calculating roots to polynomial functions
to approximate square roots by finding the root of the function
y = x^2 - n where n is the input to the function.
The function keeps track of the number of recursions to allow for a propery
test that checks it does not loop to the maximum.
The initial "guess" is n/1000 which means that inputs in the range (0.1, 1.0e12)
can be calculated in about 15 steps. This initial "guess" could be decided

Keybase proof

I hereby claim:

  • I am nathaniel-may on github.
  • I am codenoodle (https://keybase.io/codenoodle) on keybase.
  • I have a public key ASAM-c7Ay30MW3MsEyD84AMWQYnA0-1zx0hlsp2qqh4tdwo

To claim this, I am signing this object: