Skip to content

Instantly share code, notes, and snippets.

View lava's full-sized avatar

Benno Evers lava

  • Hamburg, Germany
View GitHub Profile
@lava
lava / hello_world.md
Last active March 2, 2024 17:22
Hello, world: Deep analysis of a shallow program.

Hello, world!

Please explain in detail what will happen if the following program is executed:

#include <iostream>

int main() {
    std::cout << "Hello, world!" << std::endl;
}
@lava
lava / tls_reverse_shell.md
Created February 24, 2020 17:59
CI Debugging with a TLS reverse shell

Interactive Debugging on Github Actions

Did you ever run into some issue where a job would behave slightly different in you CI environment than on your local machine? Did you ever wish you could run just a few commands in a shell on your build machine?

These are, of course rhetorical questions. And if you're using Github Actions to run your CI jobs, you'll have noticed that this use case is not supported at all. Can't create a nice walled garden if anyone could just run a CI job, after all. There are some workarounds (e.g. https://github.com/nektos/act), but since they're not officially supported they can be a bit unstable. Also, even they usually don't reproduce the exact environment found on github's servers.

@lava
lava / tls_reverse_shell.md
Last active June 1, 2022 11:39
CI Debugging with a TLS reverse shell

Interactive Debugging on Github Actions

Did you ever run into some issue where a job would behave slightly different in you CI environment than on your local machine? Did you ever wish you could run just a few commands in a shell on your build machine?

These are, of course rhetorical questions. And if you're using Github Actions to run your CI jobs, you'll have noticed that this use case is not supported at all. There are some workarounds (e.g. https://github.com/nektos/act), but since they're not officially supported they can be a bit unstable. Also, even they usually don't reproduce the exact environment found on github's servers.

Minimal Reverse Shell

@lava
lava / indicium.md
Last active April 8, 2020 10:01
Google Code Jam 2020 Indicium Analysis

Indicium

Problem 5 of the Google Code Jam 2020 qualifiers was to construct a N-by-N matrix with trace K, where each row and each column contains every number between 1 and N exactly once (aka a latin square).

The official write-up is pretty sparse, omitting the key insights of how to generate a valid trace pattern for K and how to extend the trace pattern to get a valid partial

@lava
lava / multifilter_benchmark.cpp
Created April 3, 2020 08:46
AMQ Data Structures Benchmark
#include <assert.h> // needed by vacuum.h
#include <atomic>
#include <cuckoofilter.h>
#include <xorfilter.h>
#include <iostream>
#include <morton_filter.h>
#include <ostream>
#include <random>
#include <string>
#include <thread>
@lava
lava / git_merge_cheatsheet.md
Created January 17, 2020 09:49
Git Merge Commit Cheatsheet

Git Merge Commit Cheatsheet

Show contents of merge commits in git log -p output:

git log -c

Show changes to current branch in the last 24 hours:

git rev-list --no-merges HEAD \

@lava
lava / turing.mk
Last active October 14, 2019 16:30
GNU Make Turing machine simulator
# A turing machine simulator implemented in pure GNU Make.
# (written for HackoverCTF 2018 organised by cyclopropenylidene)
blank =
space = $(blank) $(blank)
ascii-expand = \
$(subst .,. ,\
$(subst _,_ ,\
$(subst 1,1 ,\
@lava
lava / Makefile
Last active October 3, 2019 23:16
flagmaker
# Solving CTF challenges often involves a lot of work, which is very unfair to
# lazy competitors.
#
# To even things out, we designed this self-solving challenge:
# Just type `make flag` and make yourself a coffee while the solution is
# computed.
#
#
# Congratulations to all solvers! Writeups:
# https://github.com/EmpireCTF/empirectf/blob/master/writeups/2018-10-05-Hackover-CTF/README.md#500-reverse--flagmaker
@lava
lava / shitty_tls.cpp
Created May 27, 2019 13:48
Shitty TLS server that tries to proivde a zero-length certificate.
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
// Implementation of a TLS "server" that sends an empty server
// certificate to clients that try to connect.
@lava
lava / easel_post.py
Last active April 4, 2019 17:42
Postprocessing script to make FreeCAD paths importible by Easel (WIP)
# ***************************************************************************
# * (c) Benno Evers (bennoe@apache.org) 2019 *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *