Skip to content

Instantly share code, notes, and snippets.

View paolino's full-sized avatar

Paolo Veronelli paolino

  • Cardano Foundation
  • albufeira, portugal
View GitHub Profile
#include <String.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 3 }; // indirizzo IP della shield
byte gateway[] = { 192, 168, 1, 1 }; // indirizzo ip del router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
EthernetServer server(80);
{-# LANGUAGE ViewPatterns #-}
-- problem: given a list of numbers and a counter in a structure C [Int] Int
-- write a function step :: Int -> C -> C which
-- change first occurrence of a multiple of a given number in a list in its successive
-- and subtract it to the counter
-- or
-- subtract 1 to the counter and add 1 to all numbers in the list.
-- step 3 (C [1,2,3,5,6] 7) == C [1,2,4,5,6] 4
-- step 3 (C [1,2,4,5,7] 16) == C [2,3,5,6,8] 15
@paolino
paolino / STM_semantics.hs
Created October 24, 2009 10:40
an exmaple showing STM semantics
import Control.Concurrent
import Control.Concurrent.STM
main = do
c <- atomically $ newTChan :: IO (TChan ())
r <- atomically $ newTVar False
forkIO $ do
atomically $ do
r0 <- readTVar r
case r0 of
import Control.Monad.State
import Data.List
type Count = Int
data Jolly a = None | Given a | Internal (a -> Bool) | Placed Int a
pick :: Eq a => (a -> Bool) -> [a] -> StateT (Int, Jolly a) [] [a]
pick k cs = do
(i, mj) <- get
let more = case mj of
{-# LANGUAGE ExistentialQuantification #-}
-- hacked from roberto tazzoli experiment --
module Svg (renderSvg) where
import Data.List (intercalate)
import System.Random (randomRIO)
import Control.Monad (liftM2, replicateM)
data EBox = forall a . Show a => E String a

Curriculum vitae di Paolo Veronelli (paolino)

  • Nato a Milano il 22 Ottobre 1970
  • 1989: Maturità scientifica presso il Liceo G.B. Vico
  • 1990-1992: Studi presso il politecnico di Milano, ingegneria nucleare. Analisi I , II, Fisica I , II, Geometria e Programmazione Calcolatori.
  • 1992-1997: Viaggi in Europa inframezzati da studi presso la facoltà di Fisica di Bologna e sviluppo di programmi di calcolo numerico in C, C++ e Java.
  • 1998: Trasferimento in montagna e inizio della attività contadina.
  • 2001: Sviluppo di applicazioni in Python per lo scheduling delle risorse all'interno delle fabbriche metalmeccaniche.
  • 2003: Calcolo dello sviluppo dello specchio parabolico riflettore per l'illuminazione del cavo orale.
import Prelude hiding (reverse)
import Control.Arrow (first)
import Data.Set (Set)
import qualified Data.Set as S
import Data.Monoid (Monoid, mappend, mempty)
import Hakyll.Core.DirectedGraph
-- | This data structure represents the state of the dependency analyzer. It
-- holds a complete graph in 'analyzerGraph', which always contains all items,
module Dependencies (Analyzer (..), mkAnalyzer, News, Build, Graph) where
import Data.Set (Set)
import qualified Data.Set as S
import qualified Data.Map as M
import Control.Arrow ((&&&))
import Control.Applicative ((<$>))
import Data.Monoid (Monoid, mappend, mempty)
import DirectedGraph
-- | Pure item Selector
type Mask a = a -> Bool
-- | Build record, containing an action to build an item, and the dependencies.
--
-- The return value of the action computed in its monad is a set of created resources,
-- along with their compiler.
--
@paolino
paolino / Manager.hs
Created April 5, 2011 12:56
Pure interface for hakyll dependency analysis
module Manager where
-- | Yielded values from a manager. The constructor tagging mark the item for the client to act accordingly
data Yield a
= Uptodate a -- ^ this item is uptodate
| Unlink a -- ^ this item must be eliminated
| Build a -- ^ this item must be built
| Empty -- ^ the manager has no item to manage
-- | Create method. Index and value associated is given along dependency logic and existential dependency, if present.