This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
datatype ffun = const of int (* Possiamo trovare delle costanti intere *) | |
| plus of (ffun*ffun) (* Addizione *) | |
| var of string (* Variabili di tipo stringhe *) | |
| llet of (string*ffun*ffun) (* La funzione let, che prende una variabile stringa, e due oggetti di tipo ffun *) | |
| fffun of (string*ffun) (* Una funzione *) | |
| ycombinator of (ffun) | |
| appl of (ffun*ffun) | |
| ifelse of (ffun*ffun*ffun) | |
| minus of ffun | |
| prod of (ffun*ffun); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((x 1)) | |
(let | |
((y #' (lambda (z) (+ 0 x) ) )) | |
(let ((x 2)) | |
(funcall y 3) ; Returns 2 | |
))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Federico Ponzi | |
#doylefermi | |
#chocolatkey | |
# GPLv2 | |
usage() | |
{ | |
echo "Usage: $0 [-all][-list][-i] xxx.xxx.xxx.xxx" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::error::Result; | |
use crate::formats::Service; | |
use std::collections::BTreeMap; | |
/// Get a starting executon order | |
/// Result is a vector of vectors(batches) of Service. | |
/// Each batch has no dependence between each other so they can be started in parallel. | |
/// TODO: this might deadlock if `services` is not a DAG. | |
/// TODO: this topological sorting works, every process in set index i + 1 has only | |
/// dependencies in `0...i`. But, this might lead to a non optimal solution, because if a process j + 1 has a dependency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use futures::{Async, Future, Poll}; | |
use tokio::io::{AsyncRead, AsyncWrite, Error, ReadHalf, WriteHalf}; | |
use tokio::net::TcpStream; | |
use warp::{path, Filter, Stream}; | |
struct Receiver { | |
rx: ReadHalf<TcpStream>, | |
} | |
impl Stream for Receiver { | |
type Item = String; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from: https://basarat.gitbooks.io/typescript/docs/quick/nodejs.html | |
npm init -y | |
npm install typescript --save-dev | |
npm install @types/node --save-dev | |
npx tsc --init --rootDir src --outDir lib --esModuleInterop --resolveJsonModule --lib es6,dom --module commonjs | |
# Done! use `code .` to fireup visual studio. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gradle:jdk8-alpine | |
VOLUME gradle-cache:/home/gradle/.gradle | |
VOLUME /tmp | |
USER root | |
ADD . /home/gradle/project | |
WORKDIR /home/gradle/project | |
RUN chown gradle:gradle -R /home/gradle | |
USER gradle | |
RUN gradle bootJar | |
#Start from a java:8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import struct | |
import socket | |
import os | |
import sys | |
class NetworkHandler(): | |
def __init__(self, sock): | |
self.sock = sock | |
def myreceive(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IllegalMoveError(ValueError): | |
pass | |
class TicTacToe: | |
def __init__(self): | |
self.grid = [0 for i in range(9)] | |
self.turn = "x" | |
def run(self): | |
while not self.isOver(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%{ | |
#include <stdio.h> | |
int num_lines = 0, num_chars = 0; | |
%} | |
%% | |
\n ++num_lines; ++num_chars; | |
. ++num_chars; | |
%% | |
main() { |