Skip to content

Instantly share code, notes, and snippets.

@lbacik
lbacik / Dockerfile
Created July 23, 2023 13:50
jupyter notebook with php kernel
FROM debian:11
# hadolint ignore=DL3008,DL3009,DL3015
RUN apt-get -y update && apt-get -y install \
apt-transport-https \
lsb-release \
ca-certificates \
wget \
zip \
pip
docker run --rm -ti php:8.1 /bin/bash -c "
apt update
apt install -y git zip unzip
cd /opt
git clone https://github.com/lbacik/value-object.git
cd value-object
php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\"
php -r \"if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\"
php composer-setup.php
php ./composer.phar i
docker run --rm -ti php:8.1 /bin/bash -c "
apt update
apt install -y git zip unzip
cd /opt
git clone https://github.com/lbacik/value-object-illuminate-validation.git
cd value-object-illuminate-validation
php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\"
php -r \"if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;\"
php composer-setup.php

Terminal 1

$ docker run -ti debian
root@e339cd7b46d8:/# ip a show dev eth0 | grep inet
	inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
root@e339cd7b46d8:/# ls /
bin  boot  dev	etc  home  lib	lib64  media  mnt  opt	proc  root  run  sbin  srv  sys  tmp  usr  var
@lbacik
lbacik / debian.yaml
Created October 8, 2021 16:57
lima debian configuration (with turned off containerd)
images:
- location: "https://cloud.debian.org/images/cloud/bullseye/daily/20210916-767/debian-11-generic-amd64-daily-20210916-767.qcow2"
arch: "x86_64"
digest: "sha512:ed3a2631488eb4b31eed3757f936928322f2e6bc5717844173b41db0a77847ef9602e715fd16faf0b46aba2ff990d29cc79167d3940fbd1fdd9161866dee90ff"
- location: "https://cloud.debian.org/images/cloud/bullseye/daily/20210916-767/debian-11-generic-arm64-daily-20210916-767.qcow2"
arch: "aarch64"
digest: "sha512:8cb39915c402956b1e3ffd0c4e16d4cae61ed6521e65b3c578d8f099bf710297a5c51881e6ca7d0840f0cc2b4417c663a0e67c25695d560a2dabde58f4e6bd7d"
mounts:
- location: "~"
writable: false
@lbacik
lbacik / .zshrc
Last active February 14, 2025 15:46
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:$PATH:$HOME/.composer/vendor/bin:$HOME/.local/bin
#:$HOME/.symfony/bin
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
@lbacik
lbacik / backup-mysql.sh
Created March 14, 2021 08:47
simple script to backup the mysql databases
#!/usr/bin/env bash
MYSQL=mysql
MYSQLDUMP=mysqldump
GZIP=gzip
BACKUPDIR="."
IGNORED="mysql information_schema performance_schema sys"
while getopts "d:n:i:h:u:p:" opt; do
@lbacik
lbacik / init.vim
Last active February 14, 2025 15:45
syntax on
set termguicolors
" set encoding=UTF-8
set expandtab
set shiftround
set tabstop=4
set softtabstop=4
set shiftwidth=4
<?php
namespace ValueObjectTest;
use Sushi\ValueObject;
class OccupationValueObject extends ValueObject
{
const KEY_NAME = 'name';
const KEY_SALARY = 'salary';
<?php
use Sushi\ValueObject;
class ExampleValueObject extends ValueObject
{
protected $validators = [
KeysValidator::class,
InitializeValidator::class,
];