Skip to content

Instantly share code, notes, and snippets.

<?php
declare(strict_types=1);
namespace ValueObjectTest;
use Sushi\ValueObject;
class PersonValueObject extends ValueObject
{
@lbacik
lbacik / php7cc-in-sid-Dockerfile
Last active November 14, 2018 21:01
php7cc test in debian:sid
FROM debian:sid
RUN echo 'deb http://deb.debian.org/debian stretch main' >> /etc/apt/sources.list \
&& apt-get -y update && apt-get -y install \
php-parser=1.4.1-2 \
php7cc
WORKDIR /root
@lbacik
lbacik / netns.sh
Last active July 8, 2018 11:16
Usage example of NET namespace
$ ip link
$ ip route
$ sudo ip link add ve0 type veth peer name ve1
$ sudo ip address add 10.10.10.10/24 dev ve0
$ sudo ip link set ve0 up
$ sudo ip l s ve1 up
@lbacik
lbacik / pidns.sh
Last active July 1, 2018 14:44
Usage example of PID namespace
$ sudo unshare -p
-bash: fork: Cannot allocate memory
# link to the explanation
$ sudo unshare -p -f
$ ps ax
$ echo $$
@lbacik
lbacik / utsns.sh
Created July 1, 2018 13:38
Usage example of UTS namespace
hostname
# result: debian
unshare -u
# --- within UTS namespace
hostname
# result: debian
@lbacik
lbacik / mntns.sh
Last active July 1, 2018 13:36
Usage example of mnt namespace
# localization of test filesystem - please change the ROOTPATH placeholder appropriately
export CONTAINER_FS=ROOTPATH/containers/debian_fs
# UNSHARE
sudo unshare -m chroot $CONTAINER_FS
# --- within chroot
mount -t proc proc /proc
ls /proc
@lbacik
lbacik / chroot.sh
Created July 1, 2018 09:16
Simple chroot example
# localization of test filesystem - please change the ROOTPATH placeholder appropriately
export CONTAINER_FS=ROOTPATH/containers/debian_fs
sudo chroot $CONTAINER_FS
# --- within chroot
ps
# above will caused the error:
# Error, do this: mount -t proc proc /proc
@lbacik
lbacik / debootstrap.sh
Created July 1, 2018 08:55
Debian test filesystem (debootstrap)
# localization of test filesystem - please change the ROOTPATH placeholder appropriately
export CONTAINER_FS=ROOTPATH/containers/debian_fs
# preparing filesystem
mkdir -p $CONTAINER_FS
sudo debootstrap stretch $CONTAINER_FS
# let's mark this filesystem
touch $CONTAINER_FS/CONTAINER_FS