MailCow, simple html in maindomain

Mailcow is installed on a subdomain. If you need a simple HTML page on the main domain, do this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 create a conf file in data/conf/nginx with the following content:

server {
ssl_certificate /etc/ssl/mail/cert.pem;
ssl_certificate_key /etc/ssl/mail/key.pem;
index index.html;
client_max_body_size 0;
root /web;
include /etc/nginx/conf.d/listen_plain.active;
include /etc/nginx/conf.d/listen_ssl.active;
server_name visum.pt;

location ^~ /.well-known/acme-challenge/ {
allow all;
default_type “text/plain”;
}

location / {
root /web;
}
}

~Then add the index.html to data/web
~Add your domain to ADDITIONAL_SAN (https://mailcow.github.io/mailcow-dockerized-docs/firststeps-ssl/) to have proper SSL

Camouflage

Camouflaged road in Finland during WW2. 1941.

The trees were hung up with ropes. This road sat 6 miles from the Russian border, so when looking down from observation airplanes, the road would be disguised.

It was intended to be viewed obliquely (slanted) not directly from above. The suspended trees would conceal enough of the road to make it difficult to identify visually when flying past, or from surveillance photos taken from aircraft. Camouflage is designed to break up the shape of something against the background, this would have been effective within certain limits.

ASCII ART

Generating ASCII art from images using Python3 and PIL (Python Image Library)

1
pip install Pillow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from PIL import Image
import os

ASCII_CHARS = [ '#', '?', '%', '.', 'S', '+', '.', '*', ':', ',', '@']

def scale_image(image, new_width=100):
    """Resizes an image preserving the aspect ratio.
    """
    (original_width, original_height) = image.size
    aspect_ratio = original_height/float(original_width)
    new_height = int(aspect_ratio * new_width)

    new_image = image.resize((new_width, new_height))
    return new_image

def convert_to_grayscale(image):
    return image.convert('L')

def map_pixels_to_ascii_chars(image, range_width=25):
    """Maps each pixel to an ascii char based on the range
    in which it lies.

    0-255 is divided into 11 ranges of 25 pixels each.
    """

    pixels_in_image = list(image.getdata())
    pixels_to_chars = [ASCII_CHARS[pixel_value//range_width] for pixel_value in
            pixels_in_image]

    return "".join(pixels_to_chars)

def convert_image_to_ascii(image, new_width=100):
    image = scale_image(image)
    image = convert_to_grayscale(image)

    pixels_to_chars = map_pixels_to_ascii_chars(image)
    len_pixels_to_chars = len(pixels_to_chars)

    image_ascii = [pixels_to_chars[index: index + new_width] for index in
            range(0, len_pixels_to_chars, new_width)]

    return "\n".join(image_ascii)

def handle_image_conversion(image_filepath):
    image = None
    try:
        image = Image.open(image_filepath)
    except Exception as e:
        print("Unable to open image file {image_filepath}.".format(image_filepath=image_filepath))
        print(e)
        return

    image_ascii = convert_image_to_ascii(image)
    f = open(os.path.splitext(image_filepath)[0]+'.txt','w')
    f.write(image_ascii)
    f.close()

if __name__=='__main__':
    import sys

    image_file_path = 'your_path/to_your_image/goes_here.png'
    handle_image_conversion(image_file_path)