Skip to content

Examples

Dimitrios Slamaris edited this page Oct 26, 2024 · 9 revisions

LDAP

ldap-spn: Find Account by SPN

SPN = serviceclass "/" hostname [":"port] ["/" servicename]

ldapsearch -D [email protected] -W -H ldap://dc.local:3268 "(servicePrincipalName={{.arg1}}/{{.arg2}})"

Docker

get-image: Pull image from registry

The following block configures mdx so that it stops execution of code blocks, when one fails.

config:
    on-error: fail

Download docker image from hub.docker.com.

Run the following code block using mdx get-image.

docker pull alpine

run: Run command in a new container

This command defines da dependency: [run](get-image). get-image (see above). mdx run will first run get-image and then the code block below.

Create and run a new container from an image

  • -ti: --tty, --interactive

Note: -ti does not work with mdx, because we have no tty.

docker container run alpine sh -c "echo \"hello world!\""

Python

venv-shebang: Shebang support

#!/home/dim0x69/.venv/bin/python
import sys
print(sys.executable)

mdx venv-shebang will print out /home/dim0x69/.venv/bin/python