Skip to content

Instantly share code, notes, and snippets.

View eisterman's full-sized avatar

Federico Pasqua eisterman

View GitHub Profile
#nullable enable
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class BinarySearchTree : IEnumerable<int>
{
public BinarySearchTree(int value) => Value = value;
public BinarySearchTree(IEnumerable<int> values)
use std::cell::{Ref, RefCell};
pub struct BinaryTree<T> where T: Clone + PartialEq + PartialOrd {
data: T,
left: RefCell<Option<Box<BinaryTree<T>>>>,
right: RefCell<Option<Box<BinaryTree<T>>>>,
}
impl<T> BinaryTree<T> where T: Clone + PartialEq + PartialOrd {
pub fn new(root: T) -> Self {
const std = @import("std");
const c = @cImport({
@cInclude("stdlib.h");
@cInclude("stdio.h");
@cInclude("png.h");
});
const WIDTH = 800;
const HEIGHT = 600;
@eisterman
eisterman / filter.py
Created May 23, 2023 15:59
Versione base del filtro fatto a mano per il piccolo Tia
import csv
with open('input.txt', 'r', encoding='iso-8859-1') as csvfile:
reader = csv.reader(csvfile, delimiter=' ')
with open('output.txt', 'w', newline='', encoding='iso-8859-1') as outfile:
writer = csv.writer(outfile, delimiter=' ')
writer.writerow(next(reader))
for row in reader:
# 1000, 5, 28, 2
if float(row[1]) > 1000 or float(row[2]) > 5 or float(row[3]) > 28 or float(row[4]) > 2:
@eisterman
eisterman / openssl_commands.md
Last active November 28, 2022 14:38 — forked from Hakky54/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl 🔐

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@eisterman
eisterman / Program.fs
Created June 17, 2022 11:01
Statistics for Tony
open System
open Npgsql.FSharp
let connectionString : string =
Sql.host "xxx.com"
|> Sql.database "xxx"
|> Sql.username "xxx"
|> Sql.password "xxx"
|> Sql.port 12345
|> Sql.requireSslMode
@eisterman
eisterman / Program.cs
Created June 1, 2022 16:48
Console Game of Life
// See https://aka.ms/new-console-template for more information
namespace ConsoleAppGameOfLife {
public class GoLRule {
public GoLRule() {
Birth = new[] { 3 };
Stay = new[] { 2, 3 };
}
public GoLRule(int[] birth, int[] stay) {
@eisterman
eisterman / CanvasGameOfLife.cs
Created June 1, 2022 16:47
WPF Game of Life
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Threading;
import functools
import logging
import pika
from pika.adapters.asyncio_connection import AsyncioConnection
from pika.exchange_type import ExchangeType
LOGGER = logging.getLogger('ipsum.publisher')
class IpsumPublisher:
@eisterman
eisterman / advent3.py
Created December 7, 2021 23:31
Advent Of Code 2021 - 3 wrong
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 7 19:23:24 2021
@author: feder
"""
import numpy as np
file = open('input3.txt')