Skip to content

Instantly share code, notes, and snippets.

@massimo-zaniboni
massimo-zaniboni / aoc_2020_day_1_2.c
Created Dec 3, 2020
[SPOILER] AoC 2020 Day 1, part 2
View aoc_2020_day_1_2.c
/*
# 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.
View keybase.md

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 Jan 13, 2016
Problem: Find the largest prime factor of 600851475143.
View LPF.hs
module Main where
import System.Environment
--
-- Problem: Find the largest prime factor of 600851475143.
--
question = 600851475143
@massimo-zaniboni
massimo-zaniboni / gist:120af473089f27d3eede
Created Feb 15, 2015
TypeMatrix 2020 keyboard layout for quick page-up/down using keys near the cursor movement keys
View gist:120af473089f27d3eede
# 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 Oct 13, 2013
Nginx + PHP fastgci + Symfony1.X + SSL in a subfolder like www.domain-name.com/application-name/index.php
View gist:6964114
# 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;