Skip to content

Instantly share code, notes, and snippets.

@gkranasinghe
gkranasinghe / remove-docker-containers-and-untaged-images.md
Last active October 26, 2022 14:57 — forked from JPvRiel/remove-docker-containers-and-untaged-images.md
How to remove unused docker containers and images (cleanup)

Prune /var/lib/docker/overlay

sudo docker system prune -a -f

sudo docker rm -v $(sudo docker ps -a -q -f status=exited)
sudo docker rmi -f  $(sudo docker images -f "dangling=true" -q)
docker volume ls -qf dangling=true | xargs -r docker volume rm

@gkranasinghe
gkranasinghe / remove-docker-containers-and-untaged-images.md
Created October 26, 2022 14:14 — forked from JPvRiel/remove-docker-containers-and-untaged-images.md
How to remove unused docker containers and images (cleanup)

Delete all containers

$ docker ps -q -a | xargs docker rm
  • -q prints only the container IDs
  • -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

@gkranasinghe
gkranasinghe / bash_strict_mode.md
Created September 15, 2022 10:33 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@gkranasinghe
gkranasinghe / python_mysql.py
Created September 12, 2022 17:05 — forked from bradtraversy/python_mysql.py
Python & MySQL crash course for beginners
import mysql.connector
from mysql.connector import errorcode
config = {
'user': 'root',
'password': '',
'host': 'localhost',
'database': 'acme'
}
@gkranasinghe
gkranasinghe / markdown_guide.md
Created September 7, 2022 09:59 — forked from cuonggt/markdown_guide.md
The Ultimate Guide to Markdown

Markdown Guide

The Ultimate Guide to Markdown

Basic Markdown Formatting

Headings

# This is an <h1> tag

This is an tag

@gkranasinghe
gkranasinghe / App.css
Created July 21, 2022 07:41 — forked from adrianhajdin/App.css
Movie App
@import url("https://fonts.googleapis.com/css?family=Roboto+Slab:100,300,400,700");
@import url("https://fonts.googleapis.com/css?family=Raleway:300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i");
* {
margin: 0;
border: 0;
box-sizing: border-box;
}
:root {
@gkranasinghe
gkranasinghe / finished.js
Created July 21, 2022 07:14 — forked from adrianhajdin/finished.js
Amazon Scraper API
const express = require('express');
const request = require('request-promise');
const PORT = process.env.PORT || 5000;
const app = express();
app.use(express.json());
const returnScraperApiUrl = (apiKey) => `http://api.scraperapi.com?api_key=${apiKey}&autoparse=true`;