Skip to content

Instantly share code, notes, and snippets.

@xkdcc
xkdcc / docker-prune.sh
Created January 25, 2022 08:13 — forked from sethbergman/docker-prune.sh
Prune stale Docker containers, images & volumes (Bash) (versions < 1.13.0)
#!/usr/bin/env bash
stale_images=`docker images --no-trunc --quiet --filter "dangling=true"`
stale_containers=`docker ps --no-trunc --quiet --filter "status=exited"`
stale_volumes=`docker volume ls --quiet --filter "dangling=true"`
stale_images_count=`echo "$stale_images" | sed '/^\s*$/d' | wc -l | xargs`
stale_containers_count=`echo "$stale_containers" | sed '/^\s*$/d' | wc -l | xargs`
stale_volumes_count=`echo "$stale_volumes" | sed '/^\s*$/d' | wc -l | xargs`
echo "Removing stale containers..."
# -*- coding: utf-8 -*-
"""
Based on:
https://gist.github.com/meeuw/c3bc9dd07945c87c89e6#file-findfiles-py
https://bitbucket.org/nosklo/pysmbclient/wiki/Home
"""
import os
import pexpect
import re

The reStructuredText Cheat Sheet: Syntax Reminders

Info

See <http://docutils.sf.net/rst.html> for introductory docs.

Author

David Goodger <goodger@python.org>

Date

$Date: 2013-02-20 01:10:53 +0000 (Wed, 20 Feb 2013) $

Revision

$Revision: 7612 $

Description

This is a "docinfo block", or bibliographic field list

Note

If you are reading this as HTML, please read

@xkdcc
xkdcc / linkedlist.py
Created July 6, 2018 21:08 — forked from addie/linkedlist.py
Python linked list
class Node(object):
def __init__(self, data=None):
self.data = data
self.next = None
def __repr__(self):
return str(self.data)
class SinglyLinkedList(object):
def __init__(self, iterable=[]):