- Reverse the code
- Re-implment it in Rust
- Bruteforce
- ???
- Profit
This file contains hidden or 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 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) |
This file contains hidden or 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
#![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; |
This file contains hidden or 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
[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" |
This file contains hidden or 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
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) |
This file contains hidden or 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
build: | |
nasm -f elf64 -o measure.o ./measure.asm | |
ld measure.o -o measure.out -lc --dynamic-linker /lib/ld-2.33.so |
This file contains hidden or 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 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] |
This file contains hidden or 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 pwn import * | |
libc = ELF('/lib/x86_64-linux-gnu/libc-2.31.so') | |
host = '13.231.226.137' | |
port = 9573 | |
p = remote(host, port) | |
def op(): |
This file contains hidden or 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 tensorflow as tf | |
import tensorflow.keras.backend as K | |
from tensorflow.keras.metrics import Metric, AUC | |
from tensorflow.keras.backend import epsilon | |
class ConfusionMatrixMetric(Metric): | |
def __init__(self, name, **kwargs): | |
super(ConfusionMatrixMetric, self).__init__(name=name, **kwargs) | |
self.tp = self.add_weight(name='tp', initializer='zeros') | |
self.fp = self.add_weight(name='fp', initializer='zeros') |
To check if tensorflow can detect any GPU just run
python -c "import tensorflow as tf;print(tf.test.is_gpu_available(True))"
If the GPUs are available it should print True.
The easiest way to setup cuda and tensorflow-gpu is to install everything using anaconda. Anaconda do not requires root permissions and create a self-contained folder in $HOME/anaconda3.