Django-jsonfield unicode

The problem was that unicode strings i.e. Südteile are displayed as Su00fcdteile in the django-jsonfield. Sometimes the solution is really easy, but you need some time to find it:

field = jsonfield.JSONField(dump_kwargs={"ensure_ascii": False})

the 1 way to win all typewar challenges ever

I started playing typewar in 2009 when it was brand new and I liked it a lot. After playing a few hours too much I stopped at level 25.

Now a few years later I wanted to reach level 70 with a perfect score. On some spare time on EuroPython 2014 I started coding a bot playing typewar using some Python.

Using sessions in requests the login and staying logged in was really easy. Now the next step was to choose the font of the shown glyph. If not already in the database, the font was picked randomly. On the next page the result was saved for later occurrence of this glyph. The html was parsed using lxml and beautifulsoup. The data was stored using sqlalchemy using a PostgreSQL database which was totally oversized for such a small amount of datasets. The game has 21 fonts and 1092 glyphs (21 (fonts) * 26 (characters) * 2 (upper+lower case)). Due to rate limiting it took a while to get my first bot account to level 70. At level 70 this account acquired all glyphs possible and had a flawless streak of 24770 questions. The second account now knew all possible glyphs and had a flawless streak from first question till level 70 and earned all crowns possible in the game.

Overall the code consists of 265 lines of Python code.

screenshot of win

Arduino pushing data via HTTP V2

The next step is to add the photosensor and 2 DHT11 to my current humidity sensor setup.

All electronics are on a small breakout board:

Reading data from an DHT11 using an arduino is fairly simple. Library used: https://github.com/adafruit/DHT-sensor-library

Preliminaries

  • using arduino-mk

  • Arduino Linux 64bit package Version 1.0.5

Libs

A few more libs are needed

LIBS = Ethernet SPI SHT1x DHT-sensor-library
USER_LIB_PATH = ../libs/

New code added to arduino http push code:

#include "DHT.h"

// DHT11
#define DHTTYPE DHT11   // DHT 11
#define DHTPIN1 2     // pin of first DHT
#define DHTPIN2 3     // pin of second DHT

DHT dht1(DHTPIN1, DHTTYPE);
DHT dht2(DHTPIN2, DHTTYPE);


void setup()
{
  // ...

  // DHT init
  dht1.begin();
  dht2.begin();

  // ...
}

void loop()
{
  float dht1_c, dht1_h, dht2_c, dht2_h;

  if(millis() - lastConnectionTime > postingInterval) {

    // Read values from DHT11
    dht1_h = dht1.readHumidity();
    dht1_c = dht1.readTemperature();
    dht2_h = dht2.readHumidity();
    dht2_c = dht2.readTemperature();

    // ...

  }
}