ebpf.party Solutions
This is my solutions for exercises in ebpf.party.
Source code for the website is here https://github.com/DavidVentura/ebpf.party.
| # adapted from https://github.com/ArmDeveloperEcosystem/arm-learning-paths/blob/main/content/install-guides/nerdctl.md | |
| # modified for amd64 | |
| sudo apt-get update | |
| sudo apt-get install containerd | |
| NERDCTL_VERSION=$(curl -s https://api.github.com/repos/containerd/nerdctl/releases/latest | grep tag_name | cut -d '"' -f 4 | sed 's/v//') | |
| wget https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz | |
| sudo tar -xzvf nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz -C /usr/local/bin | |
| rm nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz |
This is my solutions for exercises in ebpf.party.
Source code for the website is here https://github.com/DavidVentura/ebpf.party.
| FROM ubuntu:22.04 AS build | |
| SHELL ["/bin/bash", "-c"] | |
| RUN apt-get update \ | |
| && apt-get install -y \ | |
| curl \ | |
| git \ | |
| python3 \ | |
| python3-pip \ |
| data("airquality") | |
| old_airquality <- airquality | |
| # clean the dataset | |
| airquality <- airquality[ | |
| complete.cases(airquality), | |
| !(names(airquality) %in% c("Month", "Day")) | |
| ] | |
| pairs(airquality) | |
| summary(airquality) |
The node_exporter user should be non-privileged with a shell of /sbin/nologin. This user will own the necessary directories and will run the service.
sudo useradd --system --shell /sbin/nologin --no-create-home --home-dir /var/lib/node_exporter node_exporter| #!/usr/bin/env python | |
| import can | |
| import asyncio | |
| from typing import List | |
| from can.notifier import MessageRecipient | |
| from websockets.asyncio.server import broadcast, serve | |
| connections = set() | |
| interval = 0.1 # in seconds |
| apiVersion: v1 | |
| kind: ServiceAccount | |
| metadata: | |
| name: read-only-user | |
| secrets: | |
| - name: read-only-secret | |
| --- | |
| apiVersion: rbac.authorization.k8s.io/v1 | |
| kind: ClusterRole | |
| metadata: |
| #!/usr/bin/python3 | |
| # -*- coding: utf-8 -*- | |
| from typing import Dict | |
| from nvitop import Device, GpuProcess, NA | |
| import docker | |
| from rich.console import Console | |
| from rich.table import Table | |
| from rich import box | |
| docker_client = docker.from_env() |
| ''' | |
| Check if user in github follow you back or not | |
| ''' | |
| import requests | |
| username = input("Enter your username: ") | |
| def main(username): |
| #!/usr/bin/env python | |
| """ | |
| 2020 update: | |
| - More iterators, fewer lists | |
| - Python 3 compatible | |
| - Processes files in parallel | |
| (one thread per CPU, but that's not really how it works) | |
| 2021 update: | |
| - Change from legacy format (compat32) |