Skip to content

Instantly share code, notes, and snippets.

View xpepper's full-sized avatar
💭
😏

Pietro Di Bello xpepper

💭
😏
View GitHub Profile
@xpepper
xpepper / custom.router.md
Last active May 24, 2025 09:48
To setup a custom DNS on your TIM ZTE H388X router

To setup a custom DNS on your TIM ZTE H388X router:

  • head to "Rete Locale" -> "LAN" -> Server DHCP
  • execute this script in the browser dev tools console
document.querySelectorAll('#template_DHCPBasicCfg [style*="display: none;"]').forEach(el => {
    el.style.display = ''; // Removes inline display:none
});
  • you should see
@xpepper
xpepper / Some tools and tweaks on Mac OS X.md
Last active May 6, 2025 14:52 — forked from g3d/gist:2709563
Some tools and tweaks on Mac OS X
@xpepper
xpepper / devcontainer.json
Created April 2, 2025 15:39
A devcontainer setup for practicing F# with code kata
{
"name": "F# (.NET)",
"image": "mcr.microsoft.com/devcontainers/dotnet:9.0-bookworm",
"customizations": {
"vscode": {
"extensions": [
"Ionide.Ionide-fsharp",
"ms-dotnettools.csharp",
"ms-dotnettools.vscode-dotnet-runtime"
],
@xpepper
xpepper / LondonVsChicago.md
Last active March 21, 2025 13:52
London vs Chicago, Comparative Case Study - Sandro Mancuso and Uncle Bob

My notes on the video series "London vs Chicago TDD styles" by Uncle Bob And Sandro Mancuso

The git repo of the kata is here: https://github.com/sandromancuso/cleancoders_openchat/

The "starting-point" branch is where both implementations began: https://github.com/sandromancuso/cleancoders_openchat/tree/starting-point

  • The 🇬🇧 "openchat-outside-in" branch captures the tomato by tomato history of the London approach.
  • The 🇺🇸 "openchat-unclebob" branch captures the tomato by tomato history of the Chicago approach.

What I like about Sandro's style 👍

@xpepper
xpepper / Whiteboard Cleaner Script.md
Last active March 19, 2025 04:07 — forked from lelandbatey/whiteboardCleaner.md
Take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@xpepper
xpepper / tempmail.sh
Last active February 1, 2025 00:36
A shell script to create a temporary disposable email via command line (install w3m, curl, jq)
#!/usr/bin/env sh
#
# by Siddharth Dushantha 2020
#
# Dependencies: jq, curl, w3m
#
version=1.1.9
# By default 'tmpmail' uses 'w3m' as it's web browser to render
@xpepper
xpepper / dmmf_chapter6_exercises.md
Last active January 27, 2025 22:35
Domain Modeling Made Functional - What are other practical thought exercises I could do at the end of chapter 6?

Here are some practical exercises we could do:


1. Identify Invariants in Your Own Domain

Think about a real-world system you're familiar with (e.g., a shopping cart, a library management system, a flight booking system). For each one:

  • List out the core entities in the domain.
  • Identify the key business rules (invariants) that must always hold true.
  • Ask yourself: How would you model these rules as types and functions?
@xpepper
xpepper / kill_rancher_desktop_leftovers.sh
Created January 27, 2025 21:40
Kill all Rancher Desktop leftover to be able to use again Warp client :D
#!/bin/bash
# Find all processes matching 'socket_vmnet' and kill them
ps auxwww | grep -i socket_vmnet | grep -v grep | awk '{print $2}' | xargs sudo kill

Talking about chapter 6, I want to add a question on the part where the author states "of course, we could add special runtime validation checks to make sure that this couldn’t happen."

image

The question is: Aren’t the check pushed to the edge of the system? Somewhere there will be logic for deciding if we want to create a EmailContactInfo, PostalContactInfo or BothContactMethods. Shouldn’t this logic be (unit) tested?

For sure the logic for deciding whether to create an EmailContactInfo, PostalContactInfo, or BothContactMethods does need to be implemented somewhere! In fact, this decision-making logic—let's call it the "creation logic"—becomes the entry point where the business rule is enforced. Here's how that ties into the points raised in the book and your question:

1. Pushing Validation to the Edges

Scott Wlaschin advocates for embedding business rules directly in th

@xpepper
xpepper / dmmf_chapter6_create_types_aggressively.md
Created January 26, 2025 15:17
Are we used to create too few types to model our domains?

One thing I’m getting by reading chapter 6 is that we typically create very few types for describing and modeling a business domain, while one of the key learnings I got from this chapter that we should aggressively create types to capture differences and nuances, and to properly describe the different states of business workflows. (e.g. not an EmailAddress but a UnverifiedEmailAddress and a VerifiedEmailAddress)

Chapter 6 is all about using types as a way to explicitly model and describe the domain in a precise and meaningful way. This means creating types to capture subtle differences and distinctions in your domain that are often overlooked when using a less type-focused approach.

So, yes, we should aggressively create types when modeling a business domain. This isn’t about creating types for the sake of complexity but rather about creating types to represent the real-world states and constraints of your business workflows in a clear, unambiguous way. This helps make your code more expres