Skip to content

Instantly share code, notes, and snippets.

View mauriciovasquezbernal's full-sized avatar

Mauricio Vásquez mauriciovasquezbernal

View GitHub Profile
# install dependencies
apt-get update
apt-get install git
# install golang
wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz
tar -C /usr/local/ -xzf go1.14.linux-amd64.tar.gz
sudo ln -s /usr/local/go/bin/go /usr/bin/go
ln -s /usr/local/go/bin/gofmt /usr/bin/gofmt
/* userns_child_exec.c
Licensed under GNU General Public License v2 or later
Create a child process that executes a shell command in new
namespace(s); allow UID and GID mappings to be specified when
creating a user namespace.
*/
#define _GNU_SOURCE
#include <sched.h>
@mauriciovasquezbernal
mauriciovasquezbernal / container
Created June 17, 2020 19:08
userns runc configs with docker
{
"ociVersion": "1.0.1-dev",
"process": {
"user": {
"uid": 0,
"gid": 0,
"additionalGids": [
10
]
},
{
"ociVersion":"1.0.1-dev",
"process":{
"user":{
"uid":0,
"gid":0,
"additionalGids":[
10
]
},
(otel-python-3.7) mvb@asus ~/.../opentelemetry-python $ tox -e mypy-test-sdk
mypy-test-sdk installed: aiocontextvars==0.2.2,attrs==19.3.0,contextvars==2.4,immutables==0.11,importlib-metadata==1.5.0,more-itertools==8.2.0,mypy==0.740,mypy-extensions==0.4.3,opentelemetry-api==0.4.dev0,opentelemetry-sdk==0.4.dev0,packaging==20.1,pathlib2==2.3.5,pluggy==0.13.1,py==1.8.1,pyparsing==2.4.6,pytest==5.3.5,six==1.14.0,typed-ast==1.4.1,typing-extensions==3.7.4.1,wcwidth==0.1.8,zipp==1.2.0
mypy-test-sdk run-test-pre: PYTHONHASHSEED='2498834811'
mypy-test-sdk run-test-pre: commands[0] | python -m pip install -U pip setuptools wheel
Requirement already up-to-date: pip in /home/mvb/kinvolk/LigthStep/opentelemetry/opentelemetry-python/.tox/mypy-test-sdk/lib/python3.5/site-packages (20.0.2)
Requirement already up-to-date: setuptools in /home/mvb/kinvolk/LigthStep/opentelemetry/opentelemetry-python/.tox/mypy-test-sdk/lib/python3.5/site-packages (45.2.0)
Requirement already up-to-date: wheel in /home/mvb/kinvolk/LigthStep/opente
#include <bcc/BPF.h>
#include <iostream>
#include <signal.h>
#include <string>
#define COUNTER_STRUCT \
struct counter { \
uint64_t pad; \
uint64_t counter; \
} __attribute__((packed, aligned(8)));
#include <bcc/BPF.h>
#include <iostream>
const std::string BPF_PROGRAM1 = R"(
BPF_TABLE_PUBLIC("array", int, int, mysharedtable, 1024);
)";
const std::string BPF_PROGRAM2 = R"(
BPF_TABLE("extern", int, int, mysharedtable, 1024);
)";
// Copyright 2017 Politecnico di Torino
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
#!/usr/bin/python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
from bcc import BPF
from pyroute2 import IPRoute
import time
import ctypes
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_ether.h>
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/in.h>
#include <uapi/linux/filter.h>
#include <uapi/linux/pkt_cls.h>
#include <bcc/proto.h>