Skip to content

Instantly share code, notes, and snippets.

Matthieu mchoplin

View GitHub Profile
mchoplin / container_ip
Created Apr 29, 2020
Get ip address of running docker container
View container_ip
docker inspect --format '{{ range .NetworkSettings.Networks }}{{ .IPAddress }}{{ end }}' $(docker-compose ps -q replace-with-name-of-container)
mchoplin / truncate_tables.sql
Created Apr 29, 2020
script to truncate all tables from postgres database
View truncate_tables.sql
FOR r IN (SELECT tablename FROM pg_tables
WHERE schemaname = current_schema()
AND current_database() = 'make sure you have the right database') LOOP
EXECUTE 'TRUNCATE ' || quote_ident(r.tablename) || ' CASCADE';
END $$;
### Keybase proof
I hereby claim:
* I am mchoplin on github.
* I am matthieumade ( on keybase.
* I have a public key ASAz4mTtDMulylrD70xhOC-5Ttcqeb27V4WiyJcIMnBRZAo
To claim this, I am signing this object:
mchoplin / gist:2f25220625963db3b1e5eb78da8623cd
Last active Dec 12, 2018
View gist:2f25220625963db3b1e5eb78da8623cd
# Stop all docker containers
docker container stop $(docker container ls -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Remove the volumes (--volumes), any unused images (--all), as well as override the confirmation prompt (--force)
docker system prune -a -f --volumes
You can’t perform that action at this time.