Sushi Ingredients Shopping List

For 8 persons, approx 40 rolls

  • One small mango
  • 2 ripe avocados
  • 4 blocks of Sushi grade salmon (~720gr) – In Switzerland best purchased in big Coop supermarkets
  • 1 block of Sushi grade tuna (~250g) – In Switzerland best purchased in big Coop supermarkets in the fish department)
  • 1 small cucumber
  • Two bottles of rice vinegar for sushi
  • Japonica rice – in Switzerland it’s normally labelled as Sushi rice – you might get suitable Japonica rice in a local Chinese shop (1kg) – cook in 4 separate batches
  • Philadelphia Cream Cheese (small)
  • 2 jars of Sushi pickled ginger (Gari)
  • Wasabi
  • 4 Sushi mats
  • Bunch of fresh chives (goes well with cream cheese)
  • 40 Nori sheets (8 packs)
  • Roasted (black) and normal sesame
  • 1 carrot
  • 10 cooked shrimps for shrimp nigiri

Django / DjangoCMS – custom language

We had to create custom languages in Django for two different versions of the Chinese language: yue (Mandarin Chinese) and cmn (Cantonese Chinese)

This is really simple in Django with gettext, as the default languages can just be overriden:

LANGUAGES = (
    ## Customize this
    ('en', "English"),
    ('cmn', "Mandarin Chinese"),
    ('yue', "Cantonese Chinese"),
)

CMS_LANGUAGES = {
    ## Customize this
    1: [
        {
            'code': 'en',
            'name': gettext('en'),
            'redirect_on_fallback': True,
            'public': True,
            'hide_untranslated': False,
        },
        {
            'code': 'cmn',
            'name': "Mandarin Chinese",
            'redirect_on_fallback': True,
            'public': True,
            'hide_untranslated': False,
        },
        {
            'code': 'yue',
            'name': "Cantonese Chinese",
            'redirect_on_fallback': True,
            'public': True,
            'hide_untranslated': False,
        },
    ],
    'default': {
        'redirect_on_fallback': True,
        'public': True,
        'hide_untranslated': False,
    },
}

updating from templates and python code:

./manage.py makemessages -l en
./manage.py makemessages -l yue
./manage.py makemessages -l cmn

"Plural-Forms: nplurals=2; plural=(n != 1);\n" needs to be part of every .po file for DjangoCMS

compiling
./manage.py compilemessages

django language switcher

In Django, it’s not evident how to properly switch languages. Google searches result in many different approaches, but none of them is clean. In django-cms however, there is a clean and supported approach: the language_chooser template tag.

DjangoCMS and ManifestStaticFilesStorage

  • https://docs.djangoproject.com/en/2.1/ref/contrib/staticfiles/#ManifestStaticFilesStorage
  • Allows to remove hashing from the webpack setup which is convenient
  • Allows to also hash images via {% static 'path/to/asset.jpg' %}, respectively assets that are not bundled via webpack
  • Hashing is only active if debug is False
  • The collectstatic will fail if any app that includes static assets in templates is not in INSTALLED_APPS
  • On production, collectstatic will also sometimes fail, in such cases, DEBUG has to be turned on, ./manage.py collectstatic has to be run, then DEBUG can be turned off again. See https://github.com/divio/djangocms-text-ckeditor/issues/474

Barcelona

  • Aire de Barcelona – Wellness
  • Playa Mar Bella – Chiringuitos
  • W Hotel Rooftop – view
  • Museu Nacional d’Art de Catalunya – Sunset on the stairs
  • Bajofondo Club – Cocktails
  • The Pulitzer Terrace at Hotel Pulitzer – rooftop bar
  • B-Pool Bar at B-Hotel – Tapas, view
  • Grand Hotel Central Skybar – view, drinks

NEO python Shortcuts

Installation

  • create a python virtualenv
  • pip install neo-python

Usage

  • np-prompt in your console

Private Network Setup

  • docker pull cityofzion/neo-privatenet (see https://github.com/CityOfZion/neo-privatenet-docker)
  • np-prompt -p connects to your docker private network
  • then you can import the wallet that is provided in the documentation. It has already all the NEO and GAS.

Clean up Jenkins to save disk space

-> Manage Jenkins -> Script Console

from https://gist.github.com/pkouman/c987ce8cd622820cce9111ea34662c6b

MAX_BUILDS = 10 // max builds to keep

def jobs = Jenkins.instance.items;

for (job in jobs) {
    println "Job: " + job.name
    def recent = job.builds.limit(MAX_BUILDS)
    println "Recent Builds: "  + recent
    println "============================="
    for (build in job.builds) {
        if (!recent.contains(build) && !build.isBuilding()) {
            println "Deleting: " + build
            build.delete()
            println ""
        }
    }
}

replace raven with sentry-sdk

since raven is now deprecated, this is how we should integrate sentry into our django projects: via the new pip install sentry-sdk:

settings.py: No more messing around with LOGGING is required, the following code plugs right into django:

import sentry_sdk
import logging
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration

sentry_sdk.init(
   dsn="https://1234@sentry.io/123",
   integrations=[
      DjangoIntegration(),
      LoggingIntegration(
         level=logging.INFO, # Capture info and above as breadcrumbs
         event_level=None # Send no events from log messages
      )
   ],
   environment=env('DJANGO_ENV', 'develop'),
)

django makemessages and gettext pitfalls

“Fuzzy” messages for not make it into the translation. They are not considered to be translated correctly, but they are not deleted, since they are likely to be “almost correct” and just need a small update.

Part of normal translator operations is to search out any “fuzzy” messages and verify that they are either still correct (just delete the fuzzy comment, but do not delete the python-format bit) or update them and then remove the “fuzzy”.

This isn’t anything special to Django, by the way. It’s the way
gettext-backed i18n support operates.

Malcolm Tredinnick at https://groups.google.com/forum/#!msg/django-users/SjqjUhZwJzU/DaHmdwZeZLkJ

Always use the `trimmed` option:

{% blocktrans trimmed %}
You're receiving this email because you requested a password reset for your user account at {{ business_name }}.
{% endblocktrans %}