Skip to content

Instantly share code, notes, and snippets.

View antmat's full-sized avatar

Anton Matveenko antmat

View GitHub Profile
#include <hiredis/hiredis.h>
#include <cstdlib>
#include <cstring>
#define NUM_KEYS 5000000
int main() {
struct timeval timeout = {1,0};
redisContext* context = redisConnectWithTimeout("127.0.0.1", 6379, timeout);
char** data = new char*[NUM_KEYS]; //50 mb
size_t* sizes = new size_t[NUM_KEYS];
sizes[0] = 4;
#include <hiredis/hiredis.h>
#include <string>
#include <iostream>
int main() {
struct timeval timeout = {1,0};
redisContext* context = redisConnectWithTimeout("127.0.0.1", 6378, timeout);
redisReply* reply;
std::string prefixed_key("TEST");
std::string member("1");
double increment = 1.0;
//1 pass, took 264520 micros
//2 pass, took 133738 micros
//refs, took 100183 micros
#include <iostream>
#include <random>
#include <algorithm>
#include <set>
#include <chrono>
//1 pass, took 264520 micros
//2 pass, took 133738 micros
//refs, took 100183 micros
#include <iostream>
#include <random>
#include <algorithm>
#include <set>
#include <chrono>
{
"whitelist" : {
"hello-world" : {
"allowed_hashes" :[
"sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c"
]
}
}
}
@antmat
antmat / mre
Created May 18, 2023 15:12
ext4 bug MRE
# check that there are no errors on start
host:/srv/storage# umount /dev/sdz
host:/srv/storage# fsck -nf /dev/sdz
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
antmat@antmat-dev ~/e2fsprogs 🍺 cat e2fsprogs-1.44.1/debian/patches/fix_extent_size.patch
--- e2fsprogs-1.44.1.orig/lib/ext2fs/extent.c
+++ e2fsprogs-1.44.1/lib/ext2fs/extent.c
@@ -283,9 +283,11 @@ errcode_t ext2fs_extent_open2(ext2_filsy
ext2fs_le16_to_cpu(eh->eh_entries);
handle->path[0].max_entries = ext2fs_le16_to_cpu(eh->eh_max);
handle->path[0].curr = 0;
- handle->path[0].end_blk =
- (EXT2_I_SIZE(handle->inode) + fs->blocksize - 1) >>
- EXT2_BLOCK_SIZE_BITS(fs->super);