All about Tutorials

A half-hour to learn Rust

 https://fasterthanli.me/articles/a-half-hour-to-learn-rust

Rust

Learn Rust by reading many small snippets explaining keywords and symbols.


explain.rs

 https://jrvidal.github.io/explaine.rs/

Rust

explaine.rs is an interactive playground to explore the syntax of the Rust Programming Language.

You can write any Rust code in the editor and the analyzer will allow you to click/tap on different keywords, punctuation elements and other bits of code and help you understand what they mean.


Generate SECCOMP Profiles for Containers

 https://podman.io/blogs/2019/10/15/generate-seccomp-profiles.html

Docker

This blog post explains how to generate SECCOMP profiles for containers. This is possible using podman and eBPF filters. Custom SECCOMP profiles allow to limit the container to exactly those syscalls it needs.


Hello DNS

 https://powerdns.org/hello-dns/

DNS | DNSSEC

Hello DNS is a project to write a easy to read/understand summary of the DNS specification. It provides an entrypoint to understand DNS given that the full DNS specification is easily 2000 pages in size.


IP Command Cheatsheet

 https://access.redhat.com/sites/default/files/attachments/rh_ip_command_cheatsheet_1214_jcs_print.pdf

Cheatsheet | Networks

The cheatsheet describes in few words what the different subcommands of ip do. It includes some other helpful networking commands for arping, ethtool, and ss, and provides a comparison with the older net-tools commands.


Pin and suffering

 https://fasterthanli.me/articles/pin-and-suffering

Cheatsheet | Rust

In the Pin and suffering article the author fasterthanlime explains how to implement async functions in Rust. The article starts by implementing an async function and the problem of calling blocking functions. It continues with instructions how working with Pin and Unpin futures. At the end the article explains how all of the above can be done without using the syntactic sugar of async functions.


Post-Mortem Python Plotting

 https://andyljones.com/posts/post-mortem-plotting.html

Python

The extract function copies the local variables from the current function frame into the existing Jupyter session. If the Python code crashes, you can enter the debugger with the %debug magic and then use the extract function to copy the variables from the function frame into the Jupyter session. The variables can now be properly inspected, e.g., plotted.

The original URI above contains more details how to use this post-mortem debugging.

def extract(source=None):
    """Copies the variables of the caller up to iPython. Useful for debugging.

    .. code-block:: python

        def f():
            x = 'hello world'
            extract()

        f() # raises an error

        print(x) # prints 'hello world'

    """
    import inspect
    import ctypes 

    if source is None:
        frames = inspect.stack()
        caller = frames[1].frame
        name, ls, gs = caller.f_code.co_name, caller.f_locals, caller.f_globals
    elif hasattr(source, '__func__'):
        func = source.__func__
        name, ls, gs = func.__qualname__, (func.__closure__ or {}), func.__globals__
    elif hasattr(source, '__init__'):
        func = source.__init__.__func__
        name, ls, gs = func.__qualname__, (func.__closure__ or {}), func.__globals__
    else:
        raise ValueError(f'Don\'t support source {source}')

    ipython = [f for f in inspect.stack() if f.filename.startswith('<ipython-input')][-1].frame

    ipython.f_locals.update({k: v for k, v in gs.items() if k[:2] != '__'})
    ipython.f_locals.update({k: v for k, v in ls.items() if k[:2] != '__'})

    # Magic call to make the updates to f_locals 'stick'.
    # More info: http://pydev.blogspot.co.uk/2014/02/changing-locals-of-frame-frameflocals.html
    ctypes.pythonapi.PyFrame_LocalsToFast(ctypes.py_object(ipython), ctypes.c_int(0))

    message = 'Copied {}\'s variables to {}'.format(name, ipython.f_code.co_name)
    raise RuntimeError(message)

Python Format String Syntax

 https://pyformat.info/

Cheatsheet | Python

Format string overview for the old and new format string syntax in Python. It shows for each thing you might want to perform, the old syntax (if existing), the new syntax and the output.


Real Python

 https://realpython.com/

Python

Contains a comprehesive list of tutorials, ranging from beginner to advanced. Moreover, it contains community interviews with well-known Python users, a list of Python books and quizzes.


Rust Case Studies

 https://github.com/dtolnay/case-studies

Rust

This repository showcases some examples of tricky Rust code that I have encountered during my years working with a variety of advanced macro libraries in Rust (my own and others').


Rust Cookbook

 https://rust-lang-nursery.github.io/rust-cookbook/

Cheatsheet | Rust

The Rust Cookbook describes tiny common tasks you might want to do and shows how to solve them in Rust. It introduces many usefull crates, which are widespread in the Rust ecosystem, but can also be used to look up solutions to common problems.


Task-centered iproute2 user guide

 https://baturin.org/docs/iproute2/

Cheatsheet | Networks

Userguide for the newer ip command under Linux. The guide consists of different tasks one might want to perform and their corresponding ip commands.


Tcpdump advanced filters

 https://blog.wains.be/2007/2007-10-01-tcpdump-advanced-filters/

Cheatsheet | Networks | Tools

The website contains different tcpdump filters. It starts with basic filters and then builds up ever more complex ones. This is a good source for looking up complicated filters, if one does not want to write them themself.


The Hitchhiker’s Guide to Python!

 https://docs.python-guide.org/

Python

A practical, continuously updated, handbook which provides insight into how to use Python, both as a beginner and as an expert.