Skip to content

Instantly share code, notes, and snippets.

View trebidav's full-sized avatar

David Třebický trebidav

  • Prague
View GitHub Profile
@trebidav
trebidav / icinga2.conf
Created August 10, 2018 09:43 — forked from vachanda/icinga2.conf
Nginx config for icinga2 web interface.
server {
listen *:80;
server_name www.icinga2.com;
root /usr/share/icingaweb2/public; #Path of icinga2 web directory
index index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location = /favicon.ico {
from pyroute2 import IPDB, IPRoute
import os
def create_veth_path(fd):
ip = IPDB()
# create interface pair
ip.create(ifname='pycoz0', kind='veth', peer='pycoz1').commit()
ip.release()
setup_ip('pycoz0', '10.0.0.1/24')
import os
groups_types = {'cpu': '/sys/fs/cgroup/cpu/system.slice/',
'memory': '/sys/fs/cgroup/memory/system.slice/'}
def create_cgroups(name):
for group, path in groups_types.items():
if os.path.exists(path):
target = os.path.join(path, name)
@trebidav
trebidav / cont.py
Last active June 4, 2018 09:37 — forked from rwngwn/cont.py
#!/usr/bin/env python3
# goo.gl/bRsdYQ
import ctypes
import os
from multiprocessing import Process
CLONE_NEWUSER = 0x10000000
CLONE_NEWPID = 0x20000000