D13d3l.nl
SDiedel's personal blogging space

Follow me on: Twitter | GitHub | LinkedIn

Devicemapper_docker

Cleaning up devicemapper Docker

Just run these three. No need to remove RUNNING containers.

Cleanup exited processes:

docker rm $(docker ps -q -f status=exited)

Cleanup dangling volumes:

docker volume rm $(docker volume ls -qf dangling=true)

Cleanup dangling images:

docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

Curl Base64 String Etcd

How to PUT a base64 encoded string into etcd key with cURL

When using cURL, use this command (the order is very(!) important!!!):

curl -XPUT --data-urlencode value="base64 encoded string" http://127.0.0.1:2379/v2/keys/...

Pretty Print Json In Vim

How to pretty print JSON in VIM

because why not?

Open your JSON file in VIM. Type the following command:

:%!python -m json.tool

Enjoy.

Simple Backup Script

Backup script Docker host

I use this very simple backup script for backing up my config files to my NAS

#!/bin/sh

echo Backup script for Docker volumes

# Set var
filename=$(date +%Y-%m-%d)
oldfiles=$(date +%Y-%m-%d -d "now -7 days")
backuplocation=/Backup

# Tar the entire docker mount
tar -zcf $filename.tar.gz /docker

# Remove files from 7 days ago
rm $backuplocation/$oldfiles.tar.gz
rm $backuplocation/$oldfiles.fstab

# Copy to backup location
cp $filename.tar.gz $backuplocation
cp /etc/fstab $backuplocation/$filename.fstab

# Remove tar file
rm $filename.tar.gz

Whatevah!

Mixed Content Wordpress

How to fix mixed content for Wordpress

When using an Nginx proxy you should add the following piece of code to wp-config.php:

f ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) ||
     (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) {
    $_SERVER['HTTPS'] = 'on';
}

Speedtest

Use this command to download a 10Gb file:

wget -O /dev/null http://speedtest.tele2.net/10GB.zip

Welcome

D13d3l.nl is a placeholder blog page for my domain.

I probably will use this blog for personal documentation