Skip to content

Instantly share code, notes, and snippets.

@leafnode
leafnode / script.sh
Created Oct 27, 2020
Run MySQL from docker with port mapping
View script.sh
docker run \
--detach \
--name=[container_name]\
--env="MYSQL_ROOT_PASSWORD=[my_password]" \
--publish 6603:3306 \
--volume=/root/docker/[container_name]/conf.d:/etc/mysql/conf.d \
mysql
View markdown2html.sh
#!/bin/sh
jq --slurp --raw-input '{"text": "\(.)", "mode": "markdown"}' < README.md | \
curl --data @- https://api.github.com/markdown | \
tee README.html
@leafnode
leafnode / Dockerfile
Last active Jan 16, 2020
Google Cloud SDK in docker container support
View Dockerfile
# one-liner: RUN curl -sSL https://sdk.cloud.google.com | bash
# Downloading gcloud package
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
# Installing the package
RUN mkdir -p /usr/local/gcloud \
&& tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz \
&& /usr/local/gcloud/google-cloud-sdk/install.sh
@leafnode
leafnode / script.sh
Created Dec 20, 2019
Get pods with node name with filtering #docker #kubernetes
View script.sh
#!/bin/sh
kubectl get pods -l 'app==coredump-agent' --template='{{range .items}}{{.spec.nodeName}} {{.metadata.name}}{{"\n"}}{{end}}'
kubectl get pods --template '{{range .items}}{{if eq .spec.nodeName "ip-254-0-90-30.ec2.internal"}}{{.metadata.name}}{{"\n"}}{{end}}}{{end}}'
@leafnode
leafnode / syslog_netcat.sh
Created Jul 15, 2019 — forked from dwallraff/syslog_netcat.sh
Use netcat to send syslog messages
View syslog_netcat.sh
# Here’s how to create UDP syslog messages via nc, netcat:
echo<14>_sourcehost_ messagetext’ | nc -v -u -w 0 _syslog-host_ 514
@leafnode
leafnode / script.sh
Created Jul 11, 2019
Dump network traffic from a docker container #docker
View script.sh
#!/bin/sh
# replace $container
docker run -t --net container:$container bretfisher/netshoot ngrep -d eth0 -x -q
@leafnode
leafnode / script.sh
Created Jul 11, 2019
debug container using strace #docker
View script.sh
#!/bin/sh
# replace $container
docker run --pid container:$container --cap-add SYS_PTRACE lukaszlach/strace -s 1024 -f -p 1
@leafnode
leafnode / script.sh
Created Jul 11, 2019
Run moncho/dry docker management tool #docker
View script.sh
#!/bin/sh
docker run -it -v /var/run/docker.sock:/var/run/docker.sock moncho/dry
@leafnode
leafnode / script.sh
Created Jul 11, 2019
Run local portainer #docker
View script.sh
#!/bin/sh
docker volume create portainer_data
docker run -d \
-p 9000:9000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer
@leafnode
leafnode / script.sh
Created Jul 11, 2019
Analyse docker image filesystem #docker #dive
View script.sh
#!/bin/sh
# change tag!
docker run --rm -it \
-v /usr/local/bin/docker:/bin/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "$(pwd)":"$(pwd)" \
-w "$(pwd)" \
-v "$HOME/.dive.yaml":"$HOME/.dive.yaml" \