Skip to content

Instantly share code, notes, and snippets.

View mberlanda's full-sized avatar

Mauro Berlanda mberlanda

View GitHub Profile
@mberlanda
mberlanda / mauro-prompts-reusable-patterns.md
Created June 13, 2026 08:51
Goal presenting some Claude Code prompting patterns I widely used during the summer 2026. This is a living document and will get updated along the way. And feedback, input or comment is welcome
  1. /goal . Constraints: validation must pass, commits must be atomic, PR must be opened, stop only for irreversible choices or missing credentials.
  2. Create a series of PRs, each covering one small group of atomic changes. Each PR must pass validation before moving on.
  3. Assess the current state first. Identify risks, missing tests, and broken assumptions. Then implement the smallest safe next step.
  4. Fetch all PR comments, address unresolved feedback, mark resolved only after verification, and summarize the final commit.
  5. Use this context packet: target, prior artifact, constraints, alternative datapoints. Do not overfit to one source; synthesize into the deliverable.
@mberlanda
mberlanda / scholar_mate_names_map.py
Created June 1, 2026 09:33
Python script to generate a deterministic, labeled “Scholar’s Mate Around Europe” infographic map from real Natural Earth country polygons.
#!/usr/bin/env python3
"""
Scholar's Mate Around Europe
Deterministic infographic map generator.
Install:
pip install geopandas matplotlib shapely pyproj requests pillow arabic-reshaper python-bidi
Run:
python scholars_mate_map.py
@mberlanda
mberlanda / JoinableQueueWrapper.py
Created June 17, 2022 22:24
Sample demonstration of a wrapper around a mp.JoinableQueue enforcing message deduplication via a mp.Manager and a mp.Lock.
import multiprocessing as mp
import os
import time
from dataclasses import dataclass
from datetime import datetime
@dataclass
class JobItem:
x: int
y: int
@mberlanda
mberlanda / create_session.lua
Created October 8, 2019 15:09
Sample session invalidation management with redis and lua
-------- BEGIN argv ---------
local foo = ARGV[1] -- foo
local bar = ARGV[2] -- foo:bar
local baz = ARGV[3] -- foo:baz
local val = ARGV[4]
local ttl = ARGV[5]
-------- END argv ---------
local key = "sessions::" .. foo .. "::" .. bar .. "::" .. baz
@mberlanda
mberlanda / 8queens.lua
Created July 7, 2019 15:45
Eight Queens Puzzle in Lua
N = 8 -- board size
function isplaceok(a, n, c)
for i = 1, n - 1 do -- for each queen already placed
if (a[i] == c) or -- same column?
(a[i] - i == c - n) or -- same diagonal?
(a[i] + i == c + n) then -- same diagonal?
return false -- place can be attacked
end
end
@mberlanda
mberlanda / RUBY_CHANGES.md
Last active June 12, 2019 09:32
Provide some insights about the recent ruby changes and features
@mberlanda
mberlanda / rubocop_cleanup.pl
Last active January 29, 2019 10:36
Perl script to parse rubocop configuration files and looking for dead references
#!/usr/bin/env perl -w
use 5.006;
use strict;
use warnings;
use YAML::Tiny;
use Cwd qw( cwd );
use File::Spec::Functions qw( catfile catdir );
# This scripts allows to find out which files are excluded in .rubocop.yml
@mberlanda
mberlanda / MULTIPLE_GIT_TAGGING.md
Created November 14, 2018 16:41
Multiple Git Tagging on the same repo
@mberlanda
mberlanda / rubocop.pl
Created July 30, 2018 14:13
Parse rubocop.yml and find out non existing files
#!/usr/bin/env perl -w
use 5.006;
use strict;
use warnings;
use YAML::Tiny;
use Cwd qw( cwd );
use File::Spec::Functions qw( catfile catdir );
my $yaml = YAML::Tiny->read(
@mberlanda
mberlanda / rebase_branches.sh
Created July 26, 2018 15:38
Rebase several branches
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
PROJECT_DIR=$(git rev-parse --show-toplevel)
# Base branch for rebasing
BASE_BRANCH="master"
# Enter here the name of the branches to rebase