<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: KurzGedanke</title>
    <description>The latest articles on DEV Community by KurzGedanke (@kurzgedanke).</description>
    <link>https://dev.to/kurzgedanke</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F26638%2F89fdcb99-db4b-434a-b9d7-4952f37a6b01.jpg</url>
      <title>DEV Community: KurzGedanke</title>
      <link>https://dev.to/kurzgedanke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kurzgedanke"/>
    <language>en</language>
    <item>
      <title>Help? Debugging CSS Dark Mode @media prefers-color-scheme</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Wed, 08 Jul 2020 12:45:06 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/help-debugging-css-dark-mode-media-prefers-color-scheme-1ff</link>
      <guid>https://dev.to/kurzgedanke/help-debugging-css-dark-mode-media-prefers-color-scheme-1ff</guid>
      <description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;I recently started developing my blog with the &lt;code&gt;@media (prefers-color-scheme: $THEME)&lt;/code&gt; in mind. Like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#eee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#121212&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The great thing is, due to this option the theme is corresponding with system color theme and automatically switches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But&lt;/strong&gt; I can't find a great way to debug these query and would like to ask the dev community if they know something. In the past I manually switch in my system preferences.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--M2pHtYb_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nq41j3to71m73flnfcl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--M2pHtYb_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nq41j3to71m73flnfcl.png" alt="MacOS System Preferences Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But this is somewhat laborious and changes the whole color theme of my computer...&lt;/p&gt;

&lt;p&gt;Are there maybe any browser addons for Firefox/Safari/Chrome which might help me with those querys and just changes what my browser things color theme is on? &lt;/p&gt;

&lt;p&gt;Thank you very much for your help! &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>debug</category>
      <category>dark</category>
      <category>darkmode</category>
    </item>
    <item>
      <title>Let us be coding Djinnis 🧞‍♂️🧞‍♀️</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Sat, 06 Jul 2019 14:27:50 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/let-us-be-coding-djinnis-2hih</link>
      <guid>https://dev.to/kurzgedanke/let-us-be-coding-djinnis-2hih</guid>
      <description>&lt;p&gt;Imagine you are searching through an old drawers. Somewhere you find an old coffee mug ☕️. It looks nice and you like it. You think for yourself: "Mh... after a lot of hard work, a coffee and a few dev.to post would be nice to relax!" You take the mug, clear it from the dust of the decades, put it under the coffee machine and the coffee starts running. As soon as the first drop hits the bottom of the mug a djinni appears 🧞‍♂️🧞‍♀️. At first it looks confused, but its gets conscious fast. "I'm am your personal coding djinni! I will code one app for you. What should it be?!" You start thinking... "Write your answer down in the comments!"&lt;/p&gt;




&lt;p&gt;Every developer knows this feeling: "I have a lot of cool technologies I want to test and improve my skills in" but somehow you want to do something productive, not just the "Hello World"s, Calculators and Tik-Tak-Toes. You have ideas, but sometimes there are completely out of scope to do. Something simple and still productive? Nope... nothing on mind. &lt;/p&gt;

&lt;p&gt;And I have the same problem right now. I started to learn react-native a few days ago and published my first app. &lt;a href="https://apps.apple.com/us/app/hextodec/id1471429873"&gt;Take a look if you like! (HexToDec - iOS AppStore)&lt;/a&gt; But I'm somewhat out of idea, what to do next. &lt;/p&gt;

&lt;p&gt;So I ask you: What are your problems which have not yet been solved? What App, Website (or even blog) are you missing? Post it in the comments and maybe someone will take care of it, to practice this stylish new framework or just to expand the portfolio. &lt;/p&gt;

&lt;p&gt;Let us crowdsource our needs, ideas and skills, so everybody can benefit! To easily skim the comments I would suggest some simple markup, like:&lt;/p&gt;

&lt;p&gt;Platform: e.g. iOS&lt;br&gt;
Problem: Short description of the problem&lt;br&gt;
Explanations: An in-depth discussion of the problem/app.&lt;/p&gt;

&lt;p&gt;Share your ideas, have fun building, learn something and most of all: Don't forget the self-care! &lt;/p&gt;

</description>
      <category>learning</category>
      <category>app</category>
      <category>beginners</category>
      <category>discuss</category>
    </item>
    <item>
      <title>GERMAN Wenn das Wort "Framework" Panik auslöst - Eine Methode zum schrittweise lernen</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Sat, 06 Jul 2019 02:16:24 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/german-wenn-das-wort-framework-panik-auslost-eine-methode-zum-schrittweise-lernen-2fgj</link>
      <guid>https://dev.to/kurzgedanke/german-wenn-das-wort-framework-panik-auslost-eine-methode-zum-schrittweise-lernen-2fgj</guid>
      <description>&lt;p&gt;&lt;a href="https://unsplash.com/photos/kZO9xqmO_TA"&gt;Photo by Annie Spratt on Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Das Internet und vor allem das World Wide Web ist eine weite Landschaft. &lt;a href="https://www.internetlivestats.com/total-number-of-websites/"&gt;InternetLiveStats&lt;/a&gt; sagt es gibt rund 1.700.000.000 (eine Milliarde, 700 Millionen) Webseiten. Das ist eine Menge. Im vergleich dazu gibt es knapp 1.024.470 (1 Millionen) &lt;a href="https://www.npmjs.com"&gt;npm&lt;/a&gt; Pakete. Das ist zwar nur ein Bruchteil von dem, was es an Webseiten gibt, aber immernoch sehr, sehr viel.&lt;/p&gt;

&lt;p&gt;Durch diese Masse an Paketen, Frameworks und Design Konzepte durchzublicken ist gerade am Anfang extrem überfordert und kann ab einem gewissen Punkt für viel Frust sorgen.&lt;/p&gt;

&lt;p&gt;So war es auch bei mir. Was darin resultierte, dass ich maximal bei basic HTML, CSS und Javascript geblieben bin. Oberste grenze war jQuery und Bootstrap. Worte wie React, Redux, Vue, SCSS oder Express waren das Grauen für mich. &lt;/p&gt;

&lt;p&gt;Man denkt sich: "Ich mach das jetzt!", öffnet die Dokumentation und versteht nur Bahnhof. Googelt nach Tutorials, setzt ein "Hello World" auf und versteht immer noch nicht mehr. &lt;/p&gt;

&lt;p&gt;Aber ich habe es geschafft, aus diesem Teufelskreis auszubrechen und möchte euch heute verraten wie!&lt;/p&gt;

&lt;h2&gt;
  
  
  Die Lernmethode
&lt;/h2&gt;

&lt;p&gt;Jeder lernt anders. Manche mit einem Buch, andere mit Youtube Videos, Beispiele oder Dokumentation. Ich kann mit allem was anfangen, aber nichts von dem hat mich so wirklich 100% zufrieden gestellt. Selten lag es aber am Material. Häufiger wie ich damit umgegangen bin.&lt;/p&gt;

&lt;p&gt;Diese Umgang habe ich mit &lt;a href="https://www.internetlivestats.com/total-number-of-websites/"&gt;FreeCodeCamp&lt;/a&gt; gelernt. #notSponsored&lt;/p&gt;

&lt;p&gt;FreeCodeCamp ist eine non-profit, die kostenlos Online Kurse zur Webentwicklung anbieten. Sie verwenden eine Mischung zwischen einem Praktischen und einem Theoretisch Ansatz, der auf sich aufbaut. &lt;/p&gt;

&lt;p&gt;Nehmen wir an ich möchte Javascript lernen. Ich starte also den Kurs und bekomme erst mal erzählt, was Javascript überhaupt ist. Darauf hin geht es aber recht schnell zu den Übungen. Auf der linken Seite des Bildschirms wird mir nun ein Konzept erklärt und auf der rechten Seite gibt es einen Code Editor. Man liest sich also die linke Seite, mit dem Konzept und Code Beispielen durch. Am ende gibt es eine kleine Aufgabe dieses Beispiel in die Realität umsetzen. Zum Beispiel bekommt man also erklärt, was eine Variable ist, wie die Syntax aussieht und was man damit alles so machen kann. Nachdem man es sich durchgelesen hat, soll man selber im angeschlossenen Editor eine Variable initialisieren, sie belegen oder ändern. &lt;/p&gt;

&lt;p&gt;Dadurch nimmt man das abstrakte Konzept direkt in die Hand, setzt es um und kann direkt nachvollziehen ob man es verstanden oder nicht. Bei der zweiten Übung geht es dann um Schleifen. Dort muss man also seine Wissen der Variablen mit reinbringen, aber auch das neue der Schleifen anwenden. &lt;/p&gt;

&lt;p&gt;Wozu führt das nun? &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Man sitz nicht vor einem großen Haufen an Code Beispielen, wo es verlangt wird mehrere Konzepte und Eigenarten gleichzeitig zu verstehen.&lt;/li&gt;
&lt;li&gt;Durch die direkte Anwendung dessen findet schon eine Transferleistung statt. Man muss sich direkt damit auseinandersetzen, was eine Schleife ist und überliest es nicht einfach. &lt;/li&gt;
&lt;li&gt;Wenn man diesen Prozess 2-3 durchgemacht hat, erhält man eine gute Einschätzung, wie man selber in Teilaufgaben und Konzepte unterteilt. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Und damit können wir wieder den Bogen nach oben machen. Dokumentation und Büchern. Die gleiche Methode kann man nämlich auch dort anwenden, man kriegt sie nur nicht so schön vorgekaut. Auch Bücher und die meisten Dokumentation gehen abschnittsweise und Konzept für Konzept durch. Anstatt aber nun diese nur stur zu lesen oder in zu großen Code Beispielen reinzuspringen, können wir uns währenddessen eine kleine Zusammenfassung schreiben. Nichts großes, nichts wildes. Es soll kein Lehrbuch werden. Der Clue ist aber: Wir copy &amp;amp; pasten uns nicht einfach die Beispiele, sondern schreiben unsere eigenen. Sei es, dass wir einfach die Variablen Namen ändern.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;horsepower&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;doors&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;buildYear&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;horsepower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;horsepower&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;doors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;doors&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;buildYear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;buildYear&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="nx"&gt;retun&lt;/span&gt; &lt;span class="s2"&gt;`The Car has &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;horsepower&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; horsepower and &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;doors&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; doors. It was build in &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;buildYear&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;.`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;car&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Car&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2019&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Würde zum Beispiel im Buch stehen. Darauf aufbauend übertragen wir das in meinetwegen einem Cheat-Sheet als&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Cat&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pawPower&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;birthYear&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pawPower&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;pawPower&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;birthYear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;birthYear&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="nx"&gt;retun&lt;/span&gt; &lt;span class="s2"&gt;`This is &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;. &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; has &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;pawPower&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; paws and was born in &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;birthYear&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Cat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2019&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Im Grunde, steht da das selbe. Da wir uns aber Gedanken machen, ob jetzt &lt;code&gt;pawPower&lt;/code&gt; wirklich so sinnvoll ist, machen wir uns gleichzeit mit Gedanken über &lt;code&gt;constructor&lt;/code&gt;, &lt;code&gt;this.&lt;/code&gt; und &lt;code&gt;get info(){}&lt;/code&gt;. Wir möchten ja schließlich sinnvolle Beispiele und keine die nur für sich stehen. &lt;/p&gt;

&lt;h2&gt;
  
  
  Der letzte Schritt
&lt;/h2&gt;

&lt;p&gt;Baue dinge! Die letzten Übungen zu einem Thema bestehen im FreeCodeCamp immer daraus selbstständig Dinge zu bauen. Das muss nichts großes oder außergewöhnlich sein. Vielleicht ist so gar ganz sinnvoll etwas umsetzen dessen Algorithmen und Datenstrom man schon verstanden hat. So kann man sich voll und ganz auf das Framework konzentrieren.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zusammengefast
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Breche Frameworks und Sprachen in kleine Teile auf&lt;/li&gt;
&lt;li&gt;Gehe eins nach dem anderen durch. &lt;/li&gt;
&lt;li&gt;Schreibe selbst die banalsten Code Beispiele noch ein mal mit eigenen Gedanken auf&lt;/li&gt;
&lt;li&gt;Setze deine gelernten Fähigkeiten direkt in die Praxis um&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Vielen dank fürs &lt;del&gt;Leben&lt;/del&gt; lesen, falls ihr darüber weiter quatschen möchtet, haut mich auf &lt;a href="https://chaos.social/@KurzGedanke"&gt;Mastodon&lt;/a&gt;, &lt;a href="https://twitter.com/KurzGedanke"&gt;Twitter&lt;/a&gt; oder per Mail an! &lt;/p&gt;

</description>
      <category>learning</category>
      <category>tutorial</category>
      <category>freecodecamp</category>
    </item>
    <item>
      <title>What the Day? (German)</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Tue, 08 Jan 2019 10:52:53 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/what-the-day-3ici</link>
      <guid>https://dev.to/kurzgedanke/what-the-day-3ici</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Lst2jYGi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cq9gl183q3wbvfb21jcb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Lst2jYGi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cq9gl183q3wbvfb21jcb.png" alt='Futurama Fry Meme mit "What the.... day...?" als text.'&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Es ist Tag 1. Es ist Tag 2 … es ist Tag 4 und der Congress ist für die meisten Menschen um. Doch.. was kommt danach? Tag 5? Tag 6? Ich wusste es nicht. &lt;br&gt;
Weihnachtsfeiertage und der Congress haben diese unangenehme Eigenschaft das Zeitgefühl komplett zu zerschießen. Das ist durchaus sehr angenehm, aber durchaus auch schwierig wieder zu finden wenn man sich nicht aktiv dafür entscheidet. &lt;br&gt;
Long Story Short: Ich habe einfach mal Vorlesungen verpasst, weil ich der festen Überzeugung war es wäre Mittwoch und nicht Donnerstag. Das war gar nicht mal so angenehm. Aus der Frustierheit überkam mich die Idee meines Lebens. Ich schreibe einen Mastodon Bot. &lt;/p&gt;
&lt;h2&gt;
  
  
  What The Day?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aI1FLqpQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gfhhotpdvy5uf1m7aogl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aI1FLqpQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gfhhotpdvy5uf1m7aogl.jpg" alt="Ein Screenshot des What The Days Mastodon Accounts"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://botsin.space/@whattheday"&gt;What the day? &lt;/a&gt; ist ein Mastodon Bot der alle zwölf Stunden, jeweils um 08:00 Uhr und 20:00 Uhr den Aktuellen Wochentag, das Datum und die Uhrzeit postet. Er ist Open Source und man kann ihn auf &lt;a href="https://github.com/KurzGedanke/whatTheDay"&gt;GitHub&lt;/a&gt; finden. &lt;/p&gt;
&lt;h2&gt;
  
  
  Wie ist er geschrieben?
&lt;/h2&gt;

&lt;p&gt;Ich war sehr überrascht wie einfach es ist Mastodon Bots in Python zu schreiben. Im Grunde nutze ich zwei Librarys. Ein mal &lt;a href="https://github.com/halcy/Mastodon.py"&gt;mastodon.py&lt;/a&gt; und &lt;a href="https://schedule.readthedocs.io/en/stable/"&gt;schedule&lt;/a&gt;. Mastodon.py ist einfach eine Python API Wrapper für Mastodon und das hier all der Code den es benötigt um einen Post zu verfassen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="s"&gt;'''
    Login for Mastdon and tooting a toot with the current weekday, date and time.
    '''&lt;/span&gt;
    &lt;span class="n"&gt;weekday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'%A'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;dateDMY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'%d/%m/%Y'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;clock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strftime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%X"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;mastodon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Mastodon&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;api_base_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;'https://botsin.space/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;access_token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cred&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accessToken&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;mastodon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;log_in&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;cred&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;cred&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;mastodon&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Today is {}, the {} and it is {} o&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s"&gt;clock!'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dateDMY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;clock&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;visibility&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'unlisted'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Die ersten drei Variablen, &lt;code&gt;weekday&lt;/code&gt;, &lt;code&gt;dateDMY&lt;/code&gt; und &lt;code&gt;clock&lt;/code&gt; dienen hier jeweils dazu den aktuellen Wochentag, Datum und Uhrzeit zu bekommen. &lt;br&gt;
Dadrunter findet die Anmeldung bei Mastodon statt, wobei &lt;code&gt;cred.$&lt;/code&gt; auf ein weiteres &lt;code&gt;.py&lt;/code&gt; file verweist um meine Anmeldedaten aus Git raus zu halten. &lt;br&gt;
Bei &lt;code&gt;mastodon.status_post()&lt;/code&gt; ist das Argument &lt;code&gt;visibility='unlisted'&lt;/code&gt; noch relevant, da es eher ungerne gesehen wird, wenn Bots auf die Lokale Timeline poste. Auch wenn mein Bot auf &lt;a href="https://botsin.space/"&gt;https://botsin.space/&lt;/a&gt; läuft, möchte ich mich dieser “guten Sitte” anschließen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="s"&gt;'''
    Runs the schedule for the toots at 8 o'clock and 20 o'clock.
    '''&lt;/span&gt;
    &lt;span class="n"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;every&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'08:00'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;every&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'20:00'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;post&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run_pending&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"__main__"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Der letzte abschnitt ist die &lt;code&gt;main&lt;/code&gt; Funktion mit der &lt;code&gt;schedule&lt;/code&gt; library, die auch recht eingäning zu lesen und zu nutzen ist. &lt;/p&gt;

&lt;p&gt;Im Grunde habe ich hier also einen funktionieren Mastodon Bot in knapp 40 Zeilen. Wenn das mal keine Motivation ist, selber einen zu schreiben, dann weiß ich auch nicht. &lt;/p&gt;

&lt;p&gt;Zum Schluss läuft der Bot auf einem Raspberry Pi der hier bei mir Zuhause steht. Da ich von Docker und systemd nicht all die große Ahnung habe, habe ich mich bei diesem &lt;a href="https://askubuntu.com/questions/396654/how-to-run-the-python-program-in-the-background-in-ubuntu-machine#396655"&gt;Ask Ubuntu&lt;/a&gt; Eintrag bemüht und den Befehl &lt;code&gt;nohup&lt;/code&gt; gefunden, womit der Bot nun ganz gemütlich im Hintergrund läuft. Leider werde ich bei einem Neustart des Pi den Bot ebenfalls Neustarten müssten. Vielleicht investiere ich da mal ein wenig in Docker oder systemd. &lt;/p&gt;

&lt;p&gt;Falls ihr noch Fragen dazu habt, könnt ihr mich gerne auf Mastodon kontaktieren. &lt;a href="https://chaos.social/@kurzgedanke"&gt;kurzgedanke@chaos.social&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Ansonsten wünsch ich euch noch viel Spaß beim eigenen Bot schreiben und um das aktuelle Datum nicht zu vergessen folgt &lt;a href="https://botsin.space/@whattheday"&gt;@whattheday@botsin.space&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>mastodon</category>
      <category>bots</category>
      <category>python</category>
      <category>german</category>
    </item>
    <item>
      <title>[GERMAN] Bear of the Day - Pseudo Tabellen mit Markdown und Code Blocks</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Tue, 01 May 2018 12:57:18 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/german-bear-of-the-day---pseudo-tabellen-mit-markdown-und-code-blocks-307g</link>
      <guid>https://dev.to/kurzgedanke/german-bear-of-the-day---pseudo-tabellen-mit-markdown-und-code-blocks-307g</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Dieser Tipp funktioniert leider nur eingeschränkt am Mac, da in der iOS (iPhone) Darstellung durch den kleinen Screen und Line Wrapping durcheinander gebracht wird. :( &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvjr5zh7kdfc4gjzl97n7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fvjr5zh7kdfc4gjzl97n7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Zum jetzigen Zeitpunkt (15.04.2018) besitzt &lt;a href="https://itunes.apple.com/us/app/bear-beautiful-writing-app/id1016366447?ls=1&amp;amp;mt=8" rel="noopener noreferrer"&gt;Bear for iOS (App Store Link)&lt;/a&gt; und &lt;a href="[https://itunes.apple.com/us/app/bear-beautiful-writing-app/id1016366447?ls=1&amp;amp;mt=8"&gt;Bear for Mac OS (App Store Link)&lt;/a&gt; leider nicht die Möglichkeit Tabellen darzustellen. &lt;/p&gt;

&lt;p&gt;Nun habe ich aber dennoch den Schritt gewagt und werde vollständig zu Bear umziehen, gerade da ich für mein Informatik Studium so wenig Ballast (verschiedene Apps) nutzen möchte. &lt;/p&gt;

&lt;p&gt;Als ich meine &lt;code&gt;.md&lt;/code&gt; Datein in Bear von iA Writer kopierte viel mir auf, dass meine Tabellen natürlich komplett durcheinander geraten sind. Da ich aber wusste, dass die gut formatiert waren überlegte ich diese einfach in ein &lt;code&gt;Code Block&lt;/code&gt; zu packen. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Code Blocks erzeugt man wie oben im Bild zu sehen mit drei &lt;code&gt;Gravise, einfach&lt;/code&gt;  &lt;a href="https://de.wikipedia.org/wiki/Gravis_(Typografie)" rel="noopener noreferrer"&gt;Wikipedia Link&lt;/a&gt;.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ich finde sie sehen brauchbar und gut lesbar aus, auch wenn diese Möglichkeit wahrscheinlich an ihre Grenzen läuft, wenn man wirklich lange Tabellen aufstellen möchte.&lt;/p&gt;

&lt;p&gt;In der Hoffnung, dass die Entwickler von Bear nun aber die standart Markdown Implementation von Tabellen nutzen werden, werd ich einfach so bald diese erschienen ist, die Code Blocks von den Tabellen entfernen und hoffentlich dann wunderschön aussehende Tabellen haben.&lt;/p&gt;

&lt;p&gt;Falls ihr weitere Ideen für ein Bear of the Day habt, vor allem wie ihr so mit Mathematischen Formeln umgeht, schreibt mir, &lt;a href="https://twitter.com/KurzGedanke" rel="noopener noreferrer"&gt;@KurzGedanke&lt;/a&gt;, doch einfach ein Tweet und lasst es mich wissen. 😊 &lt;/p&gt;

</description>
      <category>bear</category>
      <category>tipp</category>
      <category>german</category>
      <category>deutsch</category>
    </item>
    <item>
      <title>Beginner: Web Scraping in Mostly Pure Python</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Thu, 30 Nov 2017 18:39:09 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/beginner-web-scraping-in-mostly-pure-python-6d0</link>
      <guid>https://dev.to/kurzgedanke/beginner-web-scraping-in-mostly-pure-python-6d0</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6j22l3ifl2b2t82o80ya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6j22l3ifl2b2t82o80ya.png" alt="HTML source code of my website"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I love web scraping, especially in the beginning of learning how to code. It is fairly easy, you can learn a lot about how to handle data and you get immediate results!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But&lt;/strong&gt; I see a lot of tutorials which get overly complicated and focuses mainly on a framework called Beautiful Soup. It is a fantastic and mighty framework but most of the time - and especially for a beginner - it is completely over the top. Let's be honest, we don't want to index a complete website, most of the times we just want to download images or ask for a few values.&lt;/p&gt;

&lt;p&gt;This can be done a lot of easier with one magic word, &lt;code&gt;Regular Expressions&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Okay, okay, I hear you "whaaat? Regular expressions and easy? WTF?"&lt;/p&gt;

&lt;p&gt;Yeah, you are not wrong, RegEx aren't that easy. Personally I found it much easier to learn RegEx than an arbitrary framework which has only one use case.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What are regular expressions?
&lt;/h3&gt;

&lt;p&gt;The concept of regular expressions occurred in the 1950s. In theoretical computer science it is a sequence of characters that define a search pattern. (&lt;a href="https://en.wikipedia.org/wiki/Regular_expression" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;So, what does a regular expression looks like?&lt;/p&gt;

&lt;p&gt;Imagine we have a string:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Hi, I'm KurzGedanke and www.kurzgedanke.de is my website.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we want to get the website with the specific domain. We can assume that every input looks like &lt;code&gt;www.websiteName.tdl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One solution to match this with regular expressions might be looking like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;www&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;.&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="o"&gt;([&lt;/span&gt;a-zA-Z]&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;www&lt;/code&gt; as you might suspect, this matches exactly &lt;code&gt;www&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\.&lt;/code&gt; matches the &lt;code&gt;.&lt;/code&gt; after the &lt;code&gt;www&lt;/code&gt;. Because the dot has a function in RegEx we need to escape it with the &lt;code&gt;\&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;(.*)&lt;/code&gt; the &lt;code&gt;.&lt;/code&gt; matches any single characters. Is it the &lt;code&gt;a&lt;/code&gt; or a tab, it will match it. Besides of newlines. With the asterisc we match zero or more characters of the expression before it. In this case zero or more of any single character. The parentheses &lt;code&gt;()&lt;/code&gt; puts the match in a group which can be accessed easily.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\.&lt;/code&gt; this dot matches the dot before the top level domain.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;([a-zA-Z]*)&lt;/code&gt; here we have the top level domain, which is put in a group again with the &lt;code&gt;()&lt;/code&gt;. &lt;code&gt;[]&lt;/code&gt; are used to match a single character. In this case a character between the lower &lt;code&gt;a&lt;/code&gt; to the lower &lt;code&gt;z&lt;/code&gt; or the capital &lt;code&gt;A&lt;/code&gt; to the capital &lt;code&gt;Z&lt;/code&gt;. To get more than a single character the &lt;code&gt;*&lt;/code&gt; is used.[^This is funny and a classic mistake. I didn’t thought it through completely. A URL can of course contain a dash &lt;code&gt;-&lt;/code&gt; and I missed it.^^]&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;\s&lt;/code&gt; matches white space. In this case it is used to end the regular expression.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;To be honest, I think there are smarter ways to do this, but I find this way easy to see what’s going on and not to get overwhelmed by a 50 character long RegEx string.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To learn regular expressions I used an interactive tutorial like this: &lt;a href="https://www.regexone.com" rel="noopener noreferrer"&gt;regexone.com&lt;/a&gt;. This is not the only one out there and you can look if you find one that suites you.&lt;/p&gt;

&lt;p&gt;Another great tip are sites like &lt;a href="https://regex101.com" rel="noopener noreferrer"&gt;regex101.com&lt;/a&gt;. You can paste text in it and write directly your regex while you can see in realtime which parts are matched.. I use it everytime when I write some regex.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lets write some python
&lt;/h3&gt;

&lt;p&gt;We can use this knowledge to scrap websites. And... to be honest... I will rely on a module called &lt;a href="http://docs.python-requests.org/en/master/" rel="noopener noreferrer"&gt;Requests: HTTP for Humas&lt;/a&gt;. But this module is so easy to handle and pythonic - sometimes I have the feeling it is more pythonic than python itself.&lt;/p&gt;

&lt;p&gt;Our goal is to scrap my website and get every article title of my landing page, as well as the link to it.&lt;/p&gt;

&lt;p&gt;A simplified version of the HTML looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-list"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://kurzgedanke.de/post/headless-ssh-and-wifi-on-raspberrypi/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Headless ssh and Wifi on RaspberryPi&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hr&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://kurzgedanke.de/post/how-to-encrypt-files-with-aes/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;How to Encrypt Files with AES&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hr&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://kurzgedanke.de/post/problems-with-flask-and-pycharm/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Problems with Flask and PyCharm&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hr&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://kurzgedanke.de/post/decentraland-hot-to-mine-on-a-mac/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Decentraland | How to Mine on a Mac&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hr&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;article&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://kurzgedanke.de/post/welcome/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Welcome&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;hr&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/article&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, what are we looking for in this HTML? Let's see, we want the titles and the url of all posts. We have a few articles with the class &lt;code&gt;post-preview&lt;/code&gt;. And down below we have a &lt;code&gt;h2&lt;/code&gt; heading inside a &lt;code&gt;div&lt;/code&gt; called &lt;code&gt;post-preview-heading&lt;/code&gt;. The &lt;code&gt;h2&lt;/code&gt; contains a &lt;code&gt;a href&lt;/code&gt; which assembles a link. Might be good to go! Every &lt;code&gt;h2&lt;/code&gt; has the same structure and, we are lucky, this is the only &lt;code&gt;h2&lt;/code&gt; with this structure on this whole side. So we can assume, like above, that every input looks exactly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h2&amp;gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"linkToPostTitle"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;postTitle&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On other websites the &lt;code&gt;h2&lt;/code&gt; or the &lt;code&gt;a href&lt;/code&gt; would have a dedicated class or id like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;h2&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"post-preview-title-header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this is even better because we would have a persistent pattern which could be used to match against.&lt;/p&gt;

&lt;p&gt;Now let us write our RegEx to search for.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h2&amp;gt;&amp;lt;a href=\"https:\/\/kurzgedanke\.de\/post\/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simply represents the &lt;code&gt;&amp;lt;h2&amp;gt;&amp;lt;a href="https://kurzgedanke.de/post/&lt;/code&gt; string. Again the backslashes as well as the &lt;code&gt;double quotes&lt;/code&gt; have to be escaped.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: You can leave the escaping of the double quotes out when you use single quotes in your python code. But escaped double quotes are always the safe option.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now the rest:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h2&amp;gt;&amp;lt;a href="https:\/\/kurzgedanke\.de\/post\/(.*)\/"&amp;gt;(.*)&amp;lt;\/a&amp;gt;&amp;lt;\/h2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;(.*)&lt;/code&gt; selects everything after the &lt;code&gt;post/&lt;/code&gt; till the &lt;code&gt;/"&amp;gt;&lt;/code&gt; and puts it in a group.&lt;/li&gt;
&lt;li&gt;2. &lt;code&gt;(.*)&lt;/code&gt; matches the post title&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;\/a&amp;gt;&amp;lt;\/h2&amp;gt;&lt;/code&gt; closes of the &lt;code&gt;&amp;lt;/a&amp;gt;&lt;/code&gt; tag and the &lt;code&gt;&amp;lt;/h2&amp;gt;&lt;/code&gt; tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that we've written the regular expression let's take a look at the python code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;


&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;https://kurzgedanke.de/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;&amp;lt;h2&amp;gt;&amp;lt;a href=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https:\/\/kurzgedanke\.de\/post\/(.*)\/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt;(.*)&amp;lt;\/a&amp;gt;&amp;lt;\/h2&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;
&lt;span class="n"&gt;titleURL&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;regex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;urlAndTitle&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;titleURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Title:&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;urlAndTitle&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;URL:&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s"&gt; https://kurzgedanke.de/post/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;urlAndTitle&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;-------------------------------&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;import re&lt;/code&gt; imports the regular expression module from the standard library&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;import requests&lt;/code&gt; import the requests module from &lt;a href="https://www.kennethreitz.org" rel="noopener noreferrer"&gt;Kenneth Reitz&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;r = requests.get('https://kurzgedanke.de/')&lt;/code&gt; makes an HTTP request to &lt;em&gt;kurzgedanke.de&lt;/em&gt; and safes the data in a requests object.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;regex = r'...'&lt;/code&gt; declares a variable with the regular expression as a value. &lt;code&gt;r'...'&lt;/code&gt; tells python that this string is a regular expression.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;titleURL = re.findall(regex, r.text)&lt;/code&gt; we use the regex module to find all matches with the use of our regex variables and &lt;code&gt;r.text&lt;/code&gt; which contains the html of our http request. After everything is found it will be a list with all matches assigned to &lt;code&gt;titleURL&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;for urlAndTitle in titleURL:&lt;/code&gt; we can easily iterate over the list and access the different matches with an array notation because we grouped them up in our regular expression with the &lt;code&gt;()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you run the script it should look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Title:   Headless ssh and Wifi on RaspberryPi
URL:     https://kurzgedanke.de/post/headless-ssh-and-wifi-on-raspberrypi/
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
Title:   How to Encrypt Files with AES
URL:     https://kurzgedanke.de/post/how-to-encrypt-files-with-aes/
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
Title:   Problems with Flask and PyCharm
URL:     https://kurzgedanke.de/post/problems-with-flask-and-pycharm/
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
Title:   Decentraland | How to Mine on a Mac
URL:     https://kurzgedanke.de/post/decentraland-hot-to-mine-on-a-mac/
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
Title:   Welcome
URL:     https://kurzgedanke.de/post/welcome/
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope you found this little write up useful and learned a bit.&lt;/p&gt;

&lt;p&gt;If you have any question or remarks, please leave a comment, contact me on twitter or write a mail.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You can read this post as well on &lt;a href="https://kurzgedanke.de/post/web-scraping-in-mostly-pure-python/" rel="noopener noreferrer"&gt;kurzgedanke.de&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>webscraping</category>
      <category>requests</category>
      <category>regularexpressions</category>
    </item>
    <item>
      <title>How do you write your code?</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Tue, 28 Nov 2017 10:18:57 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/how-do-you-write-your-code-cn6</link>
      <guid>https://dev.to/kurzgedanke/how-do-you-write-your-code-cn6</guid>
      <description>&lt;p&gt;I don't know how to describe it well, so let me just start and you get an impression of what I mean.&lt;/p&gt;

&lt;p&gt;When I start writing a program or a script I asks myself, what it should do and what is necessary for it. Then I gather my material of frameworks or new things I would like to test out. My next step is to open up my text editor and lay out the basic function and classes I might need. From these classes and function I pick the one which is most important. For example I need to scrap some website, so I write the scrapping function first, because without it everything else would be useless. I debug these function till they work and go to the next higher function. At the end I write the interaction with the user. &lt;/p&gt;

&lt;p&gt;Do you have other approaches like writing the whole script in one go and then start to debug it and if so, why do you do it this way? Does a design pattern like Model-View-Controller interfere or forces you to write your code in a specific style? &lt;/p&gt;

&lt;p&gt;I'm excited for your answers! &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>discuss</category>
      <category>coding</category>
    </item>
    <item>
      <title>Headless ssh and Wifi on RaspberryPi</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Wed, 01 Nov 2017 14:57:30 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/headless-ssh-and-wifi-on-raspberrypi-21l</link>
      <guid>https://dev.to/kurzgedanke/headless-ssh-and-wifi-on-raspberrypi-21l</guid>
      <description>&lt;h4&gt;
  
  
  SSH:
&lt;/h4&gt;

&lt;p&gt;To enable SSH on a RaspberryPi with out a monitor, keyboard or mouse put your SD-Card in a card reader and plug into your main PC.&lt;/p&gt;

&lt;p&gt;Open up a terminal and navigate to the SD Card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# On Mac:
╭─loki@lokiTheGod ~
╰─$ cd /Volumes
╭─loki@lokiTheGod /Volumes
╰─$ ls
BOOTCAMP MACINTOSH HD Untitled boot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you are in the Volumes folder, which shows all drives connected to your mac. You have to create an empty &lt;code&gt;ssh&lt;/code&gt; file on the Pi SD-Card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;╭─loki@lokiTheGod /Volumes
╰─$ cd boot
╭─loki@lokiTheGod /Volumes/boot
╰─$ touch ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enter &lt;code&gt;cd boot&lt;/code&gt; to go into the Pi SD-Card and then type in &lt;code&gt;touch ssh&lt;/code&gt; to create an empty ssh file.&lt;/p&gt;

&lt;p&gt;You can verify this by typing &lt;code&gt;ls&lt;/code&gt; in your terminal.&lt;/p&gt;

&lt;h4&gt;
  
  
  WiFi:
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Personally this approach didn’t worked for me… so the easiest way to it is via Ethernet.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To enable WiFi directly on your headless Pi place a file name &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; in the boot directory of your Pi.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; is moved while the Pi starts to &lt;code&gt;/etc/wpa_supplicant/wpa_supplicant.conf&lt;/code&gt; where the the wpa configurations are located.&lt;/p&gt;

&lt;p&gt;A simple and for most networks sufficient &lt;code&gt;wpa_supplicant.conf&lt;/code&gt; looks like this:&lt;/p&gt;

&lt;h6&gt;
  
  
  WPA:
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;network={
    ssid="YOUR_SSID"
    psk="YOUR_PASSWORD"
    key_mgmt=WPA-PSK
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  WPA2:
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;network={
    ssid="YOUR_NETWORK_NAME"
    psk="YOUR_NETWORK_PASSWORD"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information on this you can look at the &lt;a href="https://wiki.archlinux.org/index.php/WPA_supplicant"&gt;Arch Wiki WPA supplicant site (Link)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Have lot of fun with your Pi!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Encrypt Files with AES</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Wed, 13 Sep 2017 09:49:24 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/how-to-encrypt-files-with-aes-doe</link>
      <guid>https://dev.to/kurzgedanke/how-to-encrypt-files-with-aes-doe</guid>
      <description>&lt;p&gt;In times of mass surveillance, public Wi-Fis and a lot of bad people trying to steal your data you want to encrypt your data before you send them over the internet.&lt;/p&gt;

&lt;p&gt;This is possible with something called &lt;em&gt;OpenSLL&lt;/em&gt; and &lt;em&gt;AES&lt;/em&gt;. &lt;em&gt;AES&lt;/em&gt; is a cryptological cipher to encrypt your data, &lt;em&gt;OpenSSL&lt;/em&gt; is a suite with cryptological stuff in it for you to use. &lt;em&gt;OpenSSL&lt;/em&gt; should be preinstalled on all &lt;em&gt;*nix&lt;/em&gt; operation system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let’s start:
&lt;/h3&gt;

&lt;p&gt;On Mac open your terminal with the spotlight search and entering &lt;code&gt;terminal&lt;/code&gt;. Hit enter to start it up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2Fencrypt_with_aes%2Fterminal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2Fencrypt_with_aes%2Fterminal.png" alt="Terminal on a Mac"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need to navigate to the folder where the file, you want to encrypt, is located. In my case this is the Desktop. If you want to know more about navigating the terminal, &lt;a href="https://computers.tutsplus.com/tutorials/navigating-the-terminal-a-gentle-introduction--mac-3855" rel="noopener noreferrer"&gt;here is a link to a tutorial.&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Of course, you can just copy the commands, but without the &lt;code&gt;$&lt;/code&gt;. This indicates just a line you can enter in the terminal.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd Desktop/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To show what files you have on your desktop you can use the &lt;code&gt;ls&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ls
very_important_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see, I have a &lt;code&gt;very_important_file.txt&lt;/code&gt;on my desktop, which I want to encrypt before I send it to my friend. To encrypt this file you can use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ openssl aes-256-cbc -a -salt -in very_important_file.txt -out someRandomName.enc

enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It asks you now for a password. You should use a real strength and long password and communicate it to a safe channel. And if you ask, the internet, even with a super fancy encrypted messenger, is not a safe channel. Let’s shortly break up the command.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;openssl&lt;/code&gt; is the cipher suite I mentioned earlier.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aes-256-cbc&lt;/code&gt; is the encryption cipher. An aes with 256 key in cbc mode.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-a&lt;/code&gt; is optional and is used for a base64 encoding which enables you to look at the file in a text editor.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-salt&lt;/code&gt; adds a nonce to the encryption and makes it even stronger&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-in&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; which file it should encrypt&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-out&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; what the name of the output file should be. You should use a random name without an extension so no one can guess the underlying file type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your friend wants to decrypt the file he/she can use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ openssl aes-256-cbc -d -a -in someRandomName.enc -out very_important_file.txt

enter aes-256-cbc decryption password:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your friend is of course asked for the password to decrypt the file. But let’s break down this command as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;openssl&lt;/code&gt; is the cipher suite I mentioned earlier.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aes-256-cbc&lt;/code&gt; is the encryption cipher. An aes with 256 key in cbc mode.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-d&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; to use decryption, not encryptipn.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-a&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; that the file was base 64 encoded. If you left the &lt;code&gt;-a&lt;/code&gt; out by the encryption, you have to leave if from the decryption out aswell.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-in&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; which file it should decrypt.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-out&lt;/code&gt; tells &lt;em&gt;OpenSSL&lt;/em&gt; the output name of the decrypted file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Please keep in mind that this is just an encryption. The file could be altered on its way through the internet by an attacker.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Problems with Flask and PyCharm</title>
      <dc:creator>KurzGedanke</dc:creator>
      <pubDate>Wed, 06 Sep 2017 11:35:44 +0000</pubDate>
      <link>https://dev.to/kurzgedanke/problems-with-flask-and-pycharm-8c1</link>
      <guid>https://dev.to/kurzgedanke/problems-with-flask-and-pycharm-8c1</guid>
      <description>&lt;p&gt;I started a new Flask project and coded it in VisualCode and a Terminal. Therefore, I set up my virtual environment, installed Flask and started to code after the &lt;a href="http://flask.pocoo.org/docs/0.12/quickstart/" rel="noopener noreferrer"&gt;Flask Quistart&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The code looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from flask import Flask
app = Flask( __name__ )

@app.route('/')
def hello_world():
    return 'Hello, World!'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I ran the app with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ export FLASK_APP=hello.py
$ flask run
 * Running on http://127.0.0.1:5000/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of the great support for Web Apps I decided to switch to PyCharm. I imported the project into PyCharm, set the Interpreter to the virtualenv, but when it hit run nothing happend….&lt;/p&gt;

&lt;p&gt;If you have the same problem: Feel welcome, I’ve got the solution!&lt;/p&gt;

&lt;p&gt;Create a New Project, choose the Flask Template and select your existing flask project folder. Say &lt;code&gt;yes&lt;/code&gt;to the pop-up which asks you to create a project from existing source.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2FflaskPyCharm%2FnewProject.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2FflaskPyCharm%2FnewProject.png" alt="PyCharm Project Creation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your project should open now and you can change your intepreter in the settings to your virtualenv or whatever you desire.&lt;/p&gt;

&lt;p&gt;If you try to run the app now you should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2FflaskPyCharm%2Fnothing.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkurzgedanke.de%2Fimg%2FflaskPyCharm%2Fnothing.png" alt="PyCharm Console with nothing in it"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I tried everything but the solution is damn simple… add this at the end of your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if __name__ == ' __main__':
    app.run()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and your console should output &lt;code&gt;* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you want to know more about the &lt;code&gt;if __name__ == ' __main__':&lt;/code&gt; line I can recommend &lt;a href="https://www.youtube.com/watch?v=sugvnHA7ElY&amp;amp;feature=youtu.be" rel="noopener noreferrer"&gt;this Video from Corey Schafer&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
