Skip to content

Instantly share code, notes, and snippets.

View sitano's full-sized avatar

Ivan Prisyazhnyy sitano

View GitHub Profile
@sitano
sitano / default_allow_unshare.json
Last active November 22, 2021 15:34
Default seccomp docker profile that allows unshare without confininig seccomp policy. See https://docs.docker.com/engine/security/seccomp/, https://github.com/moby/moby/blob/master/profiles/seccomp/default.json. `$ docker run --security-opt seccomp=./default_allow_unshare.json -it ubuntu bash, and then $ unshare -U`
{
"defaultAction": "SCMP_ACT_ERRNO",
"defaultErrnoRet": 1,
"archMap": [
{
"architecture": "SCMP_ARCH_X86_64",
"subArchitectures": [
"SCMP_ARCH_X86",
"SCMP_ARCH_X32"
]
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
#include <sched.h>
int main(void)
{
int x,status;
@sitano
sitano / parse_headers_trace.py
Last active April 26, 2021 16:27
parse output of the clang -H and render it into GraphViz dot
#!/usr/bin/python3
import argparse
import os.path
import re
import sys
import json
parser = argparse.ArgumentParser()
parser.add_argument('--file', required=True)
@sitano
sitano / gist:1c75aa3f462a1e0b19be3023d601b013
Created April 22, 2021 07:01
Scylla + clang++ headers graph
$ clang -std=c++20 -I seastar/include -I ./ -I build/dev/gen -I abseil/ -I build/dev/seastar/gen/include -DXXH_PRIVATE_API -H main.cc 2>&1 | rg '^[.]+ ' > scylla_headers_graph_dep
@sitano
sitano / get_build_time.sh
Created April 12, 2021 13:57
extract total build times per file
for name in $(fd '.*.json$' build/dev/); do cat $name | rg -o 'Total ExecuteCompiler.{50}' | rg -o 'ms":[0-9]*' | tr -d 'ms":' | awk "{print \$1 \" \" \"$name\"}"; done | sort -h > /tmp/dev_$(git rev-parse HEAD)_master.build_time
@sitano
sitano / tkz-berge.tex
Last active May 1, 2020 15:49
Updated tkz-berge.tex that works
% https://arxiv.org/pdf/1709.06005.pdf
% https://arxiv.org/pdf/1709.06005.pdf
% https://graphtheoryinlatex.wordpress.com/2011/10/17/options-for-vertices/
% The tkz-berge graph package
% Author: Alain Matthes (http://altermundus.fr/)
% Fixes: @JohnKoepi
\documentclass[]{article}
\usepackage{tikz}
@sitano
sitano / gist:a36358cd787a414125502f4b1465b1b5
Created December 13, 2019 16:39
On transaction atomicity
If someone interesting - answer to the question:
> Isn't mysql ensuring atomicty within tx?
It solely depends on the Isolation level transactions are executed against.
If we use SERIALIZABLE in database which guarantees real _serializabiltiy_
for SERIALIZABLE and not something else (like an Oracle) that transactions
are atomic, yes. Or you can think of them as of atomic because their execution
is equivalent to some serial logically correct history.
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7fea543f9700 (LWP 1244) 0x00007fea65765755 in raise () from /usr/lib/libc.so.6
2 Thread 0x7fe986a78700 (LWP 1350) 0x00007fea65927415 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
3 Thread 0x7fe94cff1700 (LWP 1378) 0x00007fea65927415 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
4 Thread 0x7fe947dfe700 (LWP 1383) 0x00007fea65927415 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
5 Thread 0x7fe94d673700 (LWP 1376) 0x00007fea65927415 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
6 Thread 0x7fe94797d700 (LWP 1384) 0x00007fea65927415 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
7 Thread 0x7fe9eebfe700 (LWP 1287) 0x00007fea6588cca3 in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
8 Thread 0x7fe9ee3fd700 (LWP 1289) 0x00007fea6588cca3 in __memmove_avx_unaligned_erms () from /usr/lib/libc.s
@sitano
sitano / strict_schedules_examples.md
Last active July 18, 2019 09:45
strict schedules examples

In Strict schedule, if the write operation of a transaction precedes a conflicting operation (Read or Write operation) of another transaction then the commit or abort operation of such transaction should also precede the conflicting operation of other transaction.

Example A

Ta	Tb
-----   -----
R(X)	
        R(X)
W(X)	
@sitano
sitano / to_adrian.md
Created June 26, 2019 12:16
About a DSG and depedency edges in Generalized Isolation Level Definitions

Hi, Adrian!

Hope you are doing well! I also hope this is the right email of yours.

I am writing to you about your article https://blog.acolyer.org/2016/02/25/generalized-isolation-level-definitions/ . I've tried to write a comment on the site, but WordPress does not show up it.

Reading an article, the phrases:

A transaction T1 depends on T2 if there is a path in the graph from T1 to T2. It directly depends on T2 if there is an edge from T1 to T2...