Skip to content

Instantly share code, notes, and snippets.

View henvo's full-sized avatar
🛹

Henning henvo

🛹
  • Zürich
  • 09:17 (UTC +02:00)
  • X @henvo
View GitHub Profile
@henvo
henvo / dsl.rb
Created January 7, 2024 16:38
Simple Ruby DSL for HTML generation
# frozen_string_literal: false
# This is the class that implements the DSL.
class Interpreter
def run(&block)
# Next line calls the block in the context of the instance.
instance_eval(&block)
end
def method_missing(name, **args, &block)
@henvo
henvo / docker-factory-reset
Last active May 20, 2018 13:42
This script stops and removes all docker containers and their images
#!/bin/bash
# WARNING: This script will remove all containers and images
echo -n "Do you want to factory-reset your docker (Y/n)? "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
# Stop all containers
docker stop $(docker ps -q)
# Delete all containers
docker rm $(docker ps -a -q)