Tag 18/2016: Python-Repräsentation einer YAML-Datei ausgeben

Zur Zeit kodifiziere ich das Setup einiger alter Server in Ansible-Skripte. Dank Virtualisierung und Cloud ist es mittlerweile einfach, Migrationen auf neue Betriebssysteme und Versionsstände im Vorfeld durchzuspielen. Die neuen Setups profitieren auch vom Know-how aus zahlreichen anderen Ansible-Scripten, z.B. auf Github, weil man immer wieder auf nützliche Vorgehensweisen und Module stößt.

Bei den Core-Modulen copy, file, lineinfile und template setze ich nach Möglichkeit immer explizit group, owner und mode so restriktiv wie möglich – der SuSE-Paranoid-Mode bei den Dateirechten fehlt mir bei Debian/Ubuntu einfach 🙂 Ansonsten Tags setzen mindestens für Packages und Services. Und vor dem Schreiben eigener Rollen lohnt es sich immer, nach bereits erprobten und universellen Rollen Ausschau zu halten.

Zwar ist die Struktur eines YAML-Dokuments leicht zu verstehen, aber trotzdem ist manchmal ein schneller Blick auf die Python-Repräsentation hilfreich. Das kann man beispielsweise mit ein paar Zeilen Python selbst erledigen. „Tag 18/2016: Python-Repräsentation einer YAML-Datei ausgeben“ weiterlesen

Super simple mailsink with Python

If your script or app sends  mail and you’ve got no time or don’t feel like configuring a real SMTP server, use a mailsink. A debugging method that in it’s simplest form just displays the result of the SMTP conversation, namely the message.

Fire up a terminal an run this code:

python -m smtpd -n -c DebuggingServer localhost:3000

This listens on port 3000 on your localhost (127.0.0.1). If you need port 25 (the SMTP default port), just run the line with sudo and enter your password:

sudo python -m smtpd -n -c DebuggingServer localhost:25

That’s it. Enjoy.

Twitter Embedded Timeline widget not loading

To quote the developers on embedded timelines:

Embeddable timelines make it easy to syndicate any public Twitter timeline to your website with one line of code.

Easy? One line of code? Give it to me!

After including it to a site… nothing happened. Why? The answer is simple…

„Twitter Embedded Timeline widget not loading“ weiterlesen

Music for better software development

A typical day at your office is as follows: You set up your workspace, grab at your project plan and prioritize your tasks. You start Emacs and load a bunch of TCL, PHP or whatever files. You concentrate on some algorithms but the moment you are really focused your colleagues step in and tell you the newest rumor heard on the evening before – unaskedly.