Pipenv Easter Egg

I’ve found this little easter egg hidden in pipenv:

if not environments.PIPENV_HIDE_EMOJIS:
    now = time.localtime()
    # Halloween easter-egg.
    if ((now.tm_mon == 10) and (now.tm_mday == 30)) or (
        (now.tm_mon == 10) and (now.tm_mday == 31)
    ):
        INSTALL_LABEL = "🎃   "
    # Christmas easter-egg.
    elif ((now.tm_mon == 12) and (now.tm_mday == 24)) or (
        (now.tm_mon == 12) and (now.tm_mday == 25)
    ):
        INSTALL_LABEL = "🎅   "

https://github.com/pypa/pipenv/blob/main/pipenv/core.py

2021 – Advent of code – Day 3

Part 1

You need to use the binary numbers in the diagnostic report to generate two new binary numbers (called the gamma rate and
the epsilon rate). The power consumption can then be found by multiplying the gamma rate by the epsilon rate.

Each bit in the gamma rate can be determined by finding the most common bit in the corresponding position of all numbers
in the diagnostic report. For example, given the following diagnostic report:

00100
11110
10110
10111
10101
01111
00111
11100
10000
11001
00010
01010


Considering only the first bit of each number, there are five 0 bits and seven 1 bits. Since the most common bit is 1, the first bit of the gamma rate is 1.

The most common second bit of the numbers in the diagnostic report is 0, so the second bit of the gamma rate is 0.

The most common value of the third, fourth, and fifth bits are 1, 1, and 0, respectively, and so the final three bits of the gamma rate are 110.

So, the gamma rate is the binary number 10110, or 22 in decimal.

The epsilon rate is calculated in a similar way; rather than use the most common bit, the least common bit from each position is used.
So, the epsilon rate is 01001, or 9 in decimal. Multiplying the gamma rate (22) by the epsilon rate (9) produces the power consumption, 198.

Use the binary numbers in your diagnostic report to calculate the gamma rate and epsilon rate, then multiply them together. What is the power consumption of the submarine? (Be sure to represent your answer in decimal, not binary.)

Reading the data

import pandas as pd

df = pd.read_csv("./aoc_day_03_test_data.txt", dtype = str, header=None)
df.columns = ["original"]

Continue reading “2021 – Advent of code – Day 3”

2021 – Advent of code – Day 2

Part 1

Today the puzzle got a bit trickier than Day 1.

The submarine seems to already have a planned course (your puzzle input). You should probably figure out where it's going. For example:

    forward 5
    down 5
    forward 8
    up 3
    down 8
    forward 2

Your horizontal position and depth both start at 0. The steps above would then modify them as follows:

    forward 5 adds 5 to your horizontal position, a total of 5.
    down 5 adds 5 to your depth, resulting in a value of 5.
    forward 8 adds 8 to your horizontal position, a total of 13.
    up 3 decreases your depth by 3, resulting in a value of 2.
    down 8 adds 8 to your depth, resulting in a value of 10.
    forward 2 adds 2 to your horizontal position, a total of 15.

After following these instructions, you would have a horizontal position of 15 and a depth of 10. (Multiplying these together produces 150.)

Calculate the horizontal position and depth you would have after following the planned course. What do you get if you multiply your final horizontal position by your final depth?

So Pandas here we go again: Continue reading “2021 – Advent of code – Day 2”

Was ist los in Deutschland

Eigentlich hatte ich mir vorgenommen nichts über Corona / Covid19 zu schreiben, weil ich weder Virologe, Epidemiologe oder Politiker bin.

Da mich die aktuelle Situation in Deutschland belastet und ich das irgendwie kanalisieren muss, schreibe ich meine Gedanken trotzdem nieder.

Normalerweise schreibe ich meine Artikel auf Englisch. Da sich aber alles hier auf die spezielle Situation in Deutschland bezieht und der Adressaten-Kreis zu größten Teilen Deutsch spricht, heute mal auf Deutsch.

Am leichtesten fällt es mir, auf konkrete Fragestellungen einzugehen, da kommt der Ausbilder in mir durch.

Ursprünglich wollte ich dieses Artikel “50 shades of Schwurbel” nennen, aber mit Polemik kommen wir nicht weiter und ich habe die Hoffnung noch nicht aufgegeben, dass viele Menschen einfach nur unsicher, schlecht oder gar falsch informiert sind.

Irgendwo habe ich gelesen, dass sich die Regierung bei der Umstellung der Postleitzahlen in den 90ern mehr Mühe gegeben hat, das neue Konzept zu kommunizieren, als beim Aufruf zur Impfung. (“Hier kommt Rolf”, “Fünf ist Trümpf”) Ein eigenes Maskottchen, großangelegte Marketingkampagne. Bei Impfung Fehlanzeige.

Ich hätte gerne mindestens einen Flyer im Briefkasten gehabt, der mir erklärt, warum Impfen gut und nützlich ist. Vielleicht auch mehrsprachig um wirklich möglichst viele Menschen zu erreichen.

Was wir bekommen haben sind Flugblätter der Misinformanten, regelrechte Misinformationskampagnen wurden gestartet:

https://correctiv.org/faktencheck/hintergrund/2020/12/18/flyer-maschinerie-corona-gegner-freiheitsboten-desinformation/

Aber nun mal rin in die Kartoffeln Continue reading “Was ist los in Deutschland”

10 tips for creating co-ownership in a code base

When you learn a new language or a framework you almost always certainly start fresh with a new clean project aka green field project.

In the industry you rarely get the chance to do so. You will have to start with code which has already been there for a specific time. These projects are called brown field. And brown not in a good sense. Brown can mean mud to sh… Continue reading “10 tips for creating co-ownership in a code base”

What is the Karman line?

tl;dr; The Karman line defines the edge of space.

It is set to 100km above the Earth’s mean sea level and separates aeronautics from astronautics. So to be an astronaut you have to travel higher than 100km from Earth’s surface.

Why is that?

To fly with a conventional airplane you need the air to generate lift under its wings. The thinner the airs gets the faster the plane has to go to generate the same amount of lift to keep the plane up. The lift generated by wings is directly proportional to the air density.

The faster the plane gets the more drag of the atmosphere on its hull is generated. Therefore the temperature of the hull increases and you will run into thermal issues with the material.

The second consideration is the oxygen you need for combustion in the plane’s engines. When you are too high you cannot use conventional turbines anymore. You have to switch to rocket engines and fuel up the plane with not only propellant but also oxygen in its tanks.

 

 

What is LEO?

LEO stands for Low Earth Orbit.

It ranges from 200km to 2000 km.

The ISS orbits the earth between 370km and 460 km. Due to atmospheric drag the orbit decreases over time

The Hubble Telescope orbits a bit higher at 545km to 549km

Other orbits

Overview

Satellite Orbit
ISS 400km
Hubble 545km
Starlink 550km
Iridium 780km
Globalstar 1.400km
ICO 13.390km
Inmarsat 35.768km
Sirius 23.975km – 46.983km