Skip to content

Instantly share code, notes, and snippets.

Matthieu mchoplin

View GitHub Profile
@mchoplin
mchoplin / gist:2f25220625963db3b1e5eb78da8623cd
Last active Dec 12, 2018
remove_docker_containers_and_images.sh
View gist:2f25220625963db3b1e5eb78da8623cd
#!/bin/bash
# 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
View keybase.io
### Keybase proof
I hereby claim:
* I am mchoplin on github.
* I am matthieumade (https://keybase.io/matthieumade) on keybase.
* I have a public key ASAz4mTtDMulylrD70xhOC-5Ttcqeb27V4WiyJcIMnBRZAo
To claim this, I am signing this object:
@mchoplin
mchoplin / truncate_tables.sql
Created Apr 29, 2020
script to truncate all tables from postgres database
View truncate_tables.sql
DO $$ DECLARE
r RECORD;
BEGIN
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 LOOP;
END $$;
@mchoplin
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)
You can’t perform that action at this time.