Skip to content

Instantly share code, notes, and snippets.

View cmizzi's full-sized avatar
🏠
Working from home

Cyril Mizzi cmizzi

🏠
Working from home
View GitHub Profile
@cmizzi
cmizzi / gist:7e1ebb83d1ce233e6d49dd7d9ed51a6f
Last active January 13, 2021 15:45
Docker function to easily connect and log containers/services
#!/bin/bash
# Show container log.
dl() {
if [ "$1" = "service" ]; then
docker service logs -f --tail 100 $2
return
fi;
docker logs -f --tail 100 $2
@cmizzi
cmizzi / .zshrc
Created September 11, 2018 08:58
Add `dl` command to access service/container logs easily
dl() {
if [ "$1" = "service" ]; then
docker service logs -f --tail 100 $2
exit 0
fi;
docker logs -f --tail 100 $2
}
__dl() {
@cmizzi
cmizzi / .zshrc
Last active January 29, 2019 13:51
Add `dockershell` command to get logged in container (service or container)
dockershell() {
if [ "$1" = "service" ]; then
ID=$(docker inspect --format '{{.Status.ContainerStatus.ContainerID}}' $(docker service ps -q "$2" | head -1))
else
ID=$2
fi;
docker exec -t -i -e PS1="$ID:\w# " "$ID" bash --noprofile --norc
}
@cmizzi
cmizzi / DaemonCommand.php
Last active May 4, 2018 08:49
Laravel daemon command
<?php
declare(strict_types=1);
declare(ticks=1);
namespace App\Console;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class DaemonCommand extends Command {