Skip to content

Instantly share code, notes, and snippets.

@mchoplin
mchoplin / gist:2f25220625963db3b1e5eb78da8623cd
Last active December 12, 2018 10:54
remove_docker_containers_and_images.sh
#!/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
### 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 April 29, 2020 11:26
script to truncate all tables from postgres database
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 April 29, 2020 11:28
Get ip address of running docker container
docker inspect --format '{{ range .NetworkSettings.Networks }}{{ .IPAddress }}{{ end }}' $(docker-compose ps -q replace-with-name-of-container)
@mchoplin
mchoplin / jira-ticket-template.md
Created June 15, 2021 10:13
Jira ticket template

h3. Description

h3. Acceptance criteria

Given When Then

h3. 3 amigos:

  • Do we need extra metrics?