Skip to content

Instantly share code, notes, and snippets.

View zommiommy's full-sized avatar
💤
Too tired to live

Tommaso Fontana zommiommy

💤
Too tired to live
View GitHub Profile
@zommiommy
zommiommy / embracenet.py
Last active March 25, 2021 10:29
Implementation of EmbraceLayer, this requires eagerly execution, for now.
from tensorflow.keras.layers import Input, Dense, Layer, Lambda
from tensorflow.keras.models import Model
import tensorflow.keras.backend as K
def setup_embrace_layer(modalities=2, num_samples=256):
def embrace(dockings):
batch_size = K.shape(dockings[0])[0]
# Compute the probabilities of extraction
selection_probabilities = tf.ones([batch_size, len(dockings)], dtype=tf.dtypes.float32)
probabilty_sum = tf.reduce_sum(selection_probabilities, axis=-1, keepdims=True) # [batch_size, 1]
@zommiommy
zommiommy / writeup.md
Last active May 17, 2021 17:57
M0lecon Writeup

M0lecon RE Writeup

TLDR

  • Reverse the code
  • Re-implment it in Rust
  • Bruteforce
  • ???
  • Profit

Automatic Rejection Machine

@zommiommy
zommiommy / Makefile
Last active May 19, 2021 19:38
Experiments on the consistency of rdtsc and rdtscp
build:
nasm -f elf64 -o measure.o ./measure.asm
ld measure.o -o measure.out -lc --dynamic-linker /lib/ld-2.33.so
@zommiommy
zommiommy / results.txt
Last active July 27, 2021 20:46
Benchmarks of different split implementations in rust.
test bench_naive_split ... bench: 2,265,338 ns/iter (+/- 136,512)
test bench_naive_split_no_escaping ... bench: 2,287,644 ns/iter (+/- 309,993)
test bench_naive_split_no_escaping_hardcoded ... bench: 2,650,552 ns/iter (+/- 27,290)
test bench_rust_default_split ... bench: 4,118,575 ns/iter (+/- 153,705)
test bench_simd_split_no_escaping ... bench: 1,707,197 ns/iter (+/- 83,440)
test bench_simd_split_no_escaping_hardcoded ... bench: 1,688,714 ns/iter (+/- 11,317)
@zommiommy
zommiommy / Cargo.toml
Last active October 8, 2021 10:46
Benchmark template
[package]
name = "bencher"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
libc = "0.2"
@zommiommy
zommiommy / bench.rs
Last active January 23, 2022 10:29
Benching of AVX dish vs relu
#![feature(portable_simd)]
#![feature(test)]
extern crate test;
use test::{black_box, Bencher};
use std::convert::TryInto;
use std::simd::*;
use std::arch::x86_64::*;
type Reg = f32x8;
@zommiommy
zommiommy / main.py
Last active May 31, 2022 14:20
Manual Logistic Regression with SGD, Momentum, Adam, Nadam
import time
import numpy as np
from tqdm.auto import trange
import matplotlib.pyplot as plt
from optimizers import SGD, Momentum, Adam, Nadam
# Generate some data
positives = np.random.normal(loc=-0.3, size=1000)
negatives = np.random.normal(loc=0.0, size=1000)
@zommiommy
zommiommy / emulator.py
Last active September 26, 2022 21:27
iki1vm-crackmeeva aka armando che mi fa' perdere tempo https://github.com/TeamItaly/TeamItalyCTF-2022/tree/master/CrackmeEVA
import struct
def u32(data):
return struct.unpack("i", data)[0]
def p32(data):
return struct.pack("i", data)
class Regs:
IP = 0
@zommiommy
zommiommy / .env
Created October 4, 2022 15:41
Elastic + Kibana + TheHive + Cortex
# Version of Elastic products
STACK_VERSION=8.4.2
# Port to expose Elasticsearch HTTP API to the host
ES_PORT=9200
# Port to expose Kibana to the host
KIBANA_PORT=5601
# RAM for each service 4GB
@zommiommy
zommiommy / lib.rs
Last active January 14, 2023 18:43
Better num-traits ?
#![deny(unconditional_recursion)]
use core::fmt::{Debug, Display, LowerHex, Binary};
use core::ops::*;
use core::sync::atomic::*;
use core::num::*;
/// Trait of operations possible on both Signed and Unsiged words
pub trait Number: Sized + Send + Sync +
Display + LowerHex +