Useful commands / snippets, updated from time to time

Generate SSH key

ed25519 is safe algorithm, it is faster than RSA and the keys are super short!

ssh-keygen -a 100 -t ed25519 -C $(whoami)@$(hostname) -f ~/.ssh/klumcz

View docker healthcheck logs:

docker inspect --format "{{json .State.Health }}" <container name> | jq

Declarative environment using Nix:

shell.nix

# shell.nix
#
# simple environment using [Nix](https://nixos.org)
# to use this file:
# 1. install Nix: `sh <(curl -L https://nixos.org/nix/install) --no-daemon`
# 2. Run command: `nix-shell`

{ pkgs ? import <nixpkgs> {}
}:

let
    myPhp = pkgs.php81.buildEnv {
        extensions = ({ enabled, all }: enabled ++ [ all.xdebug]);
        extraConfig = ''
         xdebug.mode=debug
        '';
    };
in
pkgs.mkShell {
    packages = [
        myPhp
        myPhp.packages.composer
        myPhp.packages.psysh
        pkgs.siege
        pkgs.kubectl
        pkgs.kubectx
    ];

    shellHook = ''
    '';

    APP_ENV="test";
}