Skip to content

Instantly share code, notes, and snippets.

void Obraz::HMTtransformation(int structural_element, int h) {
// Structural element
bool hit[3][3]; // Matches 1
bool miss[3][3]; // Matches 0
Choose_HMT_Structural_Element(structural_element, h, hit, miss);
// Output image
int** r1 = new int*[y];
int** g1 = new int*[y];
int** b1 = new int*[y];
@dabrowski-adam
dabrowski-adam / vomit
Last active February 18, 2018 19:41
Vomit — Shell Utility [expand directory (flatten top folder only)]
#!/bin/sh
# Vomit 0.1
# Copyright © 2018 Adam Dąbrowski
# https://opensource.org/licenses/MIT
#
# Usage: vomit [DIR]
# Move content of DIR outside and remove DIR.
@dabrowski-adam
dabrowski-adam / example.md
Last active January 4, 2024 20:06
Scala CLI – executable Markdown experiment

Advent of Code

Introduction

Download Scala CLI and run scala-cli --power run example.scala.md --main-class Main -- --in example.scala.md --out example.md in the terminal.

Scala CLI will parse the scala and scala raw code blocks in this file, install the specified dependencies, and execute this main method:

//> using scala "3.3.1"
@dabrowski-adam
dabrowski-adam / ExampleSuite.scala
Last active August 7, 2024 21:36
Scala: Weaver Test and Hedgehog Integration PoC
package com.adamdabrowski
import weaver.*
import hedgehog.*
object ExampleSuite extends SimpleIOSuite with Hedgehog:
// Passes
propertyTest("length of the result of concatenation of two lists is equal to the sum of their lengths"):
@dabrowski-adam
dabrowski-adam / pipe.scala
Created September 18, 2024 22:52
Pipe operator for Scala 3
//> using scala 3.5.0
package com.adamdabrowski.pipe
import scala.annotation.targetName
extension [A](x: => A)
@targetName("pipe")
@dabrowski-adam
dabrowski-adam / .envrc
Created October 9, 2024 21:02
Nix flake for Scala development
if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc" "sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM="
fi
use flake