Microsoft WSL CentOS / Red Hat Enterprise Linux

Some distros are available only via GitHub releases. They were implemented using (a very thin C99) OS-agnostic wrapper called WSLDL. ATM, we have Alpine, Arch, Artix, CentOS, Void (glibc & musllibc) available: https://github.com/yuk7/wsldl#install-with-prebuilt-rootfs. Navigate to one of those repos, fetch latest release build (zip) e.g. CentOS-7.5.1804.zip at https://github.com/fbigun/WSL-Distro-Rootfs/releases/tag/v0.0.1. After that […]

What’s the point of input type in GraphQL

The Object type defined above is inappropriate for re‐use here, because Objects can contain fields that express circular references or references to interfaces and unions, neither of which is appropriate for use as an input argument. For this reason, input objects have a separate type in the system. Since posting […]

Docker and IPtables

TL;DR; By default, docker daemon appends iptables rules for forwarding. For this, it uses a filter chain named DOCKER. Chain FORWARD (policy DROP) target prot opt source destination DOCKER all — 0.0.0.0/0 0.0.0.0/0 … Chain DOCKER (1 references) target prot opt source destination Moreover, when you tell docker to expose […]

Laravel custom model casts

So I ended up going down the Traits route to override various Model methods, this turns out not to be for the fainthearted as attribute casting is quite deeply embedded into the way models work. To make this work for the most general case, i.e. being able to easily add […]

How to convert string to boolean php

Depending on your needs, you should consider using filter_var() with the FILTER_VALIDATE_BOOLEAN flag. filter_var( ‘true’, FILTER_VALIDATE_BOOLEAN); // true filter_var( 1, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘1’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘on’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘yes’, FILTER_VALIDATE_BOOLEAN); // true filter_var( ‘false’, FILTER_VALIDATE_BOOLEAN); // false filter_var( 0, FILTER_VALIDATE_BOOLEAN); // false filter_var( ‘0’, […]