Skip to content

Instantly share code, notes, and snippets.

View siers's full-sized avatar
:octocat:

Raitis Veinbahs siers

:octocat:
  • Basel, Switzerland
View GitHub Profile
@siers
siers / NaiveCopy.hs
Created January 4, 2024 12:51
Naive directory tree copy with full contents in memory and using recursion schemes (cata/anaM)
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UnicodeSyntax #-}
@siers
siers / gist:63df7694c42062349c57c89969a9fbc7
Created August 27, 2024 14:08
nix-shell --run 'python -m uploadserver' oneliner
nix-shell -E 'with (import <nixpkgs> {}); with python3; mkShell { buildInputs = [ (withPackages (p: [(pkgs.buildPythonPackage rec { pname = "uploadserver"; version = "5.2.1"; src = fetchPypi { inherit pname version; hash = "sha256-qp2xkzLvnrnx8dHZpwlF3RjRg8jYC7WAaVS4ltJFZaU="; }; })]) ) ]; }' --run "python -m uploadserver 65353"
# you're welcome
@siers
siers / 2025-05-17-dual-dictionary.html
Last active December 19, 2025 15:27
local dual wiktionary viewer
<!DOCTYPE html>
<meta charset="utf-8">
<script>
function arrayRotate(arr, count) {
const len = arr.length
arr.push(...arr.splice(0, (-count % len + len) % len))
return arr
}
//
@siers
siers / gist:d5ef0bd9cee3b1119a2a9539bff26a38
Created January 30, 2026 19:53
programm randomization code
--- scales
{keys=ss(`A Eb`);}
Scales: {keys} {[`three octaves`, scalePositions()]}
Scales: {zipSpace(keys, ss(`thirds, sixths, octaves`))} [scalePositionsDbl()]
--- bowing
Bowing: arches over [pick(`dim sixths`)], p{divide(ss(`1 2 3 4 5 6`), 2)}
--- shifting
Shifting: position 4 [pick(s(`octaves from 1st, shifts 1-4, shifts 1234`))] [s(`G D A E`)] [s(`0 -1 +1`)]
Shifting: Sevcik, no gliss [ss(`G D A E`)]
-=-