Skip to content

Instantly share code, notes, and snippets.

View massimo-zaniboni's full-sized avatar

Massimo Zaniboni massimo-zaniboni

View GitHub Profile
@massimo-zaniboni
massimo-zaniboni / aoc_2020_day_1_2.c
Created December 3, 2020 00:43
[SPOILER] AoC 2020 Day 1, part 2
/*
# AoC day1 part 2
## Idea
Instead of thinking to combinatorial problem, I were inspired from pattern matching algo like https://en.wikipedia.org/wiki/Rete_algorithm
I read the file as a sequence of events and I maintain a data structure with the values we need for answering the question.
When we ecounter it, the solution is returned.

Keybase proof

I hereby claim:

  • I am massimo-zaniboni on github.
  • I am mzan (https://keybase.io/mzan) on keybase.
  • I have a public key ASBZ_ZEDaPMhxVv0x2rVLqzfaHiJZ0dwR9IlGXFitic-uwo

To claim this, I am signing this object:

@massimo-zaniboni
massimo-zaniboni / LPF.hs
Created January 13, 2016 12:49
Problem: Find the largest prime factor of 600851475143.
module Main where
import System.Environment
--
-- Problem: Find the largest prime factor of 600851475143.
--
question = 600851475143
@massimo-zaniboni
massimo-zaniboni / gist:120af473089f27d3eede
Created February 15, 2015 09:40
TypeMatrix 2020 keyboard layout for quick page-up/down using keys near the cursor movement keys
# This BASH script set Dvorak Layout (not mandatory),
# and custom layout for quick page-up/down using keys near the cursor movement keys
setxkbmap "us(dvp)"
xmodmap /home/zanibonim/.Xmodmap
# This is the .Xmodmap file content, setting a custom layout for special keys.
# In particular:
# * function+"Right-Ctrl": page up
# * function+"Right-3-KeyPad": page down
@massimo-zaniboni
massimo-zaniboni / gist:6964114
Created October 13, 2013 16:25
Nginx + PHP fastgci + Symfony1.X + SSL in a subfolder like www.domain-name.com/application-name/index.php
# NOTE:
# * substitute domain-name.com with the correct domain name
# * substitute application with the real name of the application
# * substitute application_directory with the real directory where it is installed the application
server {
listen 443 ssl;
server_name www.domain-name.com domain-name.com;
root /var/www/html;
keepalive_timeout 70;