Skip to content

Instantly share code, notes, and snippets.

View mberlanda's full-sized avatar

Mauro Berlanda mberlanda

View GitHub Profile
@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 / MULTIPLE_GIT_TAGGING.md
Created November 14, 2018 16:41
Multiple Git Tagging on the same repo
@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 / RUBY_CHANGES.md
Last active June 12, 2019 09:32
Provide some insights about the recent ruby changes and features
@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 / 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 / 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