Skip to content

Instantly share code, notes, and snippets.

@eisterman
eisterman / Cargo.toml
Created March 8, 2018 11:52
Mandelbrot Code
[package]
name = "mandelbrot"
version = "0.1.0"
authors = ["Federico Pasqua <federico.pasqua.96@gmail.com>"]
[dependencies]
num = "0.1.41"
image = "0.18.0"
crossbeam = "0.3.0"
num_cpus = "1.8.0"
@eisterman
eisterman / lib.rs
Created April 2, 2018 19:37
Demotest Rust Hasher who return the Square Sum of the hashed values
use std::hash::Hasher;
use std::hash::BuildHasher;
struct SquareSumHasher {
state: u64,
}
impl SquareSumHasher {
fn new(state: u64) -> Self {
SquareSumHasher { state }
@eisterman
eisterman / main_multithread.rs
Last active May 5, 2018 14:01
Numeric integral CLI in Rust!
extern crate argparse;
extern crate meval;
extern crate crossbeam;
extern crate num_cpus;
#[macro_use]
extern crate generator;
use argparse::{ArgumentParser, Store};
use meval::Expr;
@eisterman
eisterman / get_last_block.rs
Created October 27, 2019 22:44
Funzione Multithread "monca" NameChain
fn get_last_block(bc_file: &Arc<Mutex<File>>) -> io::Result<String> {
let mut f = bc_file.lock().unwrap();
let a = BufReader::new(f.deref_mut()).lines();
a.last().unwrap()
}
use vulkano::instance::Instance;
use vulkano::instance::InstanceExtensions;
use vulkano::instance::PhysicalDevice;
use vulkano::device::Device;
use vulkano::device::DeviceExtensions;
use vulkano::device::Features;
use vulkano::buffer::BufferUsage;
use vulkano::buffer::CpuAccessibleBuffer;
use vulkano::command_buffer::AutoCommandBufferBuilder;
use vulkano::command_buffer::CommandBuffer;
@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')
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 / 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;
@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 / 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