Skip to content

Instantly share code, notes, and snippets.

View tomato42's full-sized avatar

Hubert Kario tomato42

View GitHub Profile
@tomato42
tomato42 / xfs-bloat.c
Created March 9, 2015 22:01
Utility to fill up XFS file system without writing data to disk
/*
* xfs-bloat.c
*
* Create a file that allocates a large amount of space on an XFS file system.
*
* Compilation:
* gcc -Wall xfs-bloat.c -o xfs-bloat
*/
#include <xfs/xfs.h>
@tomato42
tomato42 / powmod.py
Created November 19, 2016 14:19
Modular exponentiation
from __future__ import print_function
import sys
import getopt
import math
g = None
e = None
m = None
argv = sys.argv[1:]
@tomato42
tomato42 / groups.py
Created November 19, 2016 14:41
Calculate size of groups in modular exponentiation
from __future__ import print_function
import sys
import getopt
import math
g = None
m = None
argv = sys.argv[1:]
opts, args = getopt.getopt(argv, "m:")
from __future__ import print_function
import sys
import getopt
import math
g = None
m = None
argv = sys.argv[1:]
opts, args = getopt.getopt(argv, "m:")
@tomato42
tomato42 / idid
Last active April 11, 2018 15:31
Quick logging and reporting of performed tasks from this and last week
#!/bin/bash
MYDIR=~/.local/share/idid
mkdir -p "$MYDIR"
echo $(date -u --iso-8601=seconds) $@ >> "$MYDIR"/log
# number of subjects in each condition
n <- 10000
# number of replications of the study in order to check the Type I error rate
nsamp <- 10000
ps <- replicate(nsamp, {
#population mean = 0, sd = 1 for both samples, therefore, no real effect
y1 <- rnorm(n, 0, 1)
y2 <- rnorm(n, 0, 1)
tt <- ks.test(y1, y2)
@tomato42
tomato42 / password_server.c
Created October 15, 2023 18:45
Example server checking password with a timing side-channel and a tlsfuzzer script to attack it
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>