Skip to content

Instantly share code, notes, and snippets.

View Janiczek's full-sized avatar

Martin Janiczek Janiczek

View GitHub Profile
@Janiczek
Janiczek / crc32.hvm
Created February 28, 2024 18:27
CRC32 in HVM
/*
CRC32 in HVM
A port of https://github.com/openbsd/src/blob/d4c9bc7e07bcf455e26a4d261eb43cf80a9b7fe1/bin/md5/crc.c
*/
testString = "foo bar baz" // --> CRC: 2461288740
main = (CRC.run testString)
# Fast macOS key repeat
https://apple.stackexchange.com/questions/10467/how-to-increase-keyboard-key-repeat-rate-on-os-x
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
@Janiczek
Janiczek / .vimrc
Created January 20, 2024 17:53
Elm errors in the editor
" ALE
let g:ale_linters = {
\ 'elm': ['make'],
\ }
Plug 'dense-analysis/ale'
Plug 'blueyed/vim-qf_resize'
let g:ale_linters_explicit = 1
let g:ale_open_list = 1
@Janiczek
Janiczek / Main.elm
Created December 3, 2023 07:21
Synchronous string normalization in Elm
module Main exposing (main)
import Html exposing (Html)
import Json.Decode
import Json.Encode
main : Html msg
main =
Html.ul []
@Janiczek
Janiczek / Common.elm
Last active September 15, 2023 21:37
Elm implementations of shortest distance between two 3D line segments
module Common exposing
( Point
, Segment
, add
, addK
, distance
, dot
, magnitude
, mid
, scale
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/nvim-lsp-installer'
Plug 'lifepillar/vim-mucomplete'
" LSP Elm+Tailwind tries:
lua << EOF
require("nvim-lsp-installer").setup({
#!/usr/bin/env node
// A work around to https://github.com/avh4/elm-format/issues/352
// * Use it in place of elm-format (only some flags are supported)
// * Run it from a directory containing node_modules/elm-format/bin/elm-format (but you can change it below)
function extractFirstRegexMatch(regex, elmCode) {
package example
object Hello {
def main(args: Array[String]): Unit =
println("Hello")
// 1 implicit conversions
// NEVER USE THIS
{
import scala.language.implicitConversions
@Janiczek
Janiczek / Main.elm
Created January 11, 2023 17:05
Benchmark List.init
module Main exposing (..)
import Benchmark as Bench exposing (Benchmark)
import Benchmark.Runner.Alternative as Runner exposing (Program)
main : Program
main =
Runner.program suite
@Janiczek
Janiczek / Pred.elm
Last active December 4, 2022 21:34
Advent of Code 2022-04 - code synthesis
module Pred exposing (..)
import List.Cartesian
import Transform
type alias Example =
( Range, Range )