Skip to content

Instantly share code, notes, and snippets.

View rimelek's full-sized avatar

Ákos Takács rimelek

View GitHub Profile
@rimelek
rimelek / compose.yml
Last active January 29, 2023 16:20
Testing a webapplication in Docker Desktop without internet access
# Open a web browser from a web browser
# curl localhost:3000
networks:
default:
internal: true
public:
services:
php:
image: itsziget/phar-examples:1.0
@rimelek
rimelek / zsh-docker-context-prompt-agnoster.sh
Created December 30, 2022 20:30
Custom prompt showing the current Docker context configured using environment variables. ZSH theme is "agnoster". This gist is not the whole zshrc file, only the relevant parts.
ZSH_THEME="agnoster"
plugins=(git docker docker-compose)
prompt_docker_host() {
docker_icon="\xF0\x9F\x90\xB3"
if [[ -n "$DOCKER_HOST" ]]; then
if [[ -n "$DOCKER_CONTEXT_HOST" ]] && [[ "$DOCKER_CONTEXT_HOST" == "$DOCKER_HOST" ]]; then
prompt_segment red default "$docker_icon $DOCKER_CONTEXT"
else
@rimelek
rimelek / container-desktop-shell.sh
Created December 18, 2022 14:18
Custom shell to use Docker Desktop and Rancher Desktop on the same machine using their own clients
#!/bin/bash
set -eu -o pipefail
function docker_desktop() {
CONTEXT_DESC="Docker Desktop"
DD_HOME="$HOME/.docker"
@rimelek
rimelek / Dockerfile
Created August 9, 2019 19:53
Test attaching to a docker container's standard input
FROM ubuntu
CMD bash -c 'echo -n "Type your name: " && read name && echo -n "Your name is " && echo $name && sleep 4'
# Test commands:
# docker build -t attachtest .
# docker run -d -it --name attachtest-container attachtest
# docker attach attachtest-container
# docker rm -f attachtest-container
# # Output should be the name you typed
<?php
$str = 'r_\T_W
[QBQSC_^ID
yBZ
UWI
U]QY\D
]UBD
QJ
U\C_