playing with eBPF interface - 1

eBPF is a revolutionary technology that can run sandboxed programs in the Linux kernel without changing kernel source code or loading kernel modules. Basically any user can write code for a virtual machine that can interact with the kernel data structure and functions. bcc is an high-level helper interface to eBPF (another is bpftrace). To use it, start by following installation guide , but if you have a recent Debian system, it’s just a matter of installing some packages: ...

May 11, 2021 · Andrea Manzini

a 'pythonic' fileinput module for the D programming language

When I write small command line utilities in Python, I often take advantage of the fileinput module that makes working with text files very convenient: the library permits to write quickly and easily a loop over standard input or a list of files, something like perl -a or awk line processing. Then the size of input data grew, and also for a language comparison, I wanted to port my utility in the D programming language, but I cannot find an equivalent module, so I decided to write one myself. ...

January 25, 2021 · Andrea Manzini

Writing Python modules in Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. It’s Efficient, expressive, elegant and definitely worth to check. While I was playing with it, I stumbled upon an interesting module that allows almost seamless interoperability betweeen Nim and Python; so I’m building a small proof of concept on this github project. first of all the Nim code: # file: demo.nim - file name should match the module name you're going to import from python import nimpy import unicode proc greet(name: string): string {.exportpy.} = return "Hello, " & name & "!" proc count(names: seq[string]): int {.exportpy.} = return names.len proc lowercase(names: seq[string]): seq[string] {.exportpy.} = for n in names: result.add tolower(n) ...

December 5, 2020 · Andrea Manzini

A new project to learn the Crystal Programming Language

I’ve started a new side project named Crystal Koans, it’s a simple series of exercises organized as a big unit test suite. The “koans” are heavily inspired by similar projects for other languages, but I didn’t found anything similar for Crystal. The project has been included in the awesome collection under the official Learning Resource for the language. I’ll try to maintain and evolve it in the spare time, I hope you’ll find it useful, and any form of contribution is welcome. ...

November 20, 2020 · Andrea Manzini