Skip to content

Instantly share code, notes, and snippets.

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 / 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()
}
@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 / 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 / Cargo.toml
Created March 8, 2018 11:52
Mandelbrot Code
[package]
name = "mandelbrot"
version = "0.1.0"
authors = ["Federico Pasqua <[email protected]>"]
[dependencies]
num = "0.1.41"
image = "0.18.0"
crossbeam = "0.3.0"
num_cpus = "1.8.0"
@eisterman
eisterman / vector.rs
Created March 2, 2018 16:30
Vector2 by eisterman
extern crate num;
use num::Float;
use std::ops::{Add,Sub,Mul};
#[derive(Debug, Eq, PartialEq)]
struct Vector2<T> {
x: T,
y: T,
}
@eisterman
eisterman / log2.txt
Created February 22, 2018 16:26
NewLib issue ArchLinux
==> Making package: x86_64-unknown-redox-newlib-git r17774.d5ac42a49-1 (Thu Feb 22 17:22:12 CET 2018)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating newlib git repo...
-> Updating rust git repo...
==> Validating source files with md5sums...
newlib ... Skipped
rust ... Skipped
==> Extracting sources...
@eisterman
eisterman / PrimeCached.rs
Created January 7, 2018 17:56
Inserisci in stdin la quantità di numeri in input e infine quali n-esimi numeri primi si vuole sapere
use std::io;
use std::fmt::Write;
/*
STDIN:
4
7 1 199999 4
STDOUT:
17 2 2750131 7
@eisterman
eisterman / main.rs
Created December 22, 2017 16:53
Mandelbrot Fractal PNG with Multithreading
extern crate crossbeam;
extern crate num;
use num::Complex;
/// Try to determine if `c` is in the Mandelbrot set, using at most `limit`
/// iterations to decide.
///
/// If `c` is not a member, return `Some(i)` where `i` is the number of
/// iterations it took for `c` to leave the circle of radius two centered on the
/// origin. If `c` seems to be a member (more precisely, if we reached the
@eisterman
eisterman / main.rs
Created December 22, 2017 16:10
Mandelbrot Fractal Singlethread
extern crate num;
use num::Complex;
/// Try to determine if `c` is in the Mandelbrot set, using at most `limit`
/// iterations to decide.
///
/// If `c` is not a member, return `Some(i)` where `i` is the number of
/// iterations it took for `c` to leave the circle of radius two centered on the
/// origin. If `c` seems to be a member (more precisely, if we reached the
/// iteration limit without being able to prove that `c` is not a member),