Sr. Developer @easytechgreen

Week of the 30/03/2020 - #14

Contents

Tech

  • file2img a small utility that can interpret any binary file as image data
  • Upload files to Amazon S3 with a bash script
  • MVP.css — Minimalist stylesheet for HTML elements
  • Drupal + AMP Presentation (DrupalCon Seattle 2019)
  • Drupal Marketing Material
  • Keyboard over Wifi with an ESP8266

Science

  • Lecture slides from Deep Natural Language Processing Oxford University course
  • Trax: state of the art deep learning library
  • How to calculate cost of a particular device based on wattage
  • Feynman’s PhD Thesis

Design

  • Creating beautiful and engaging infographics and slides

Art

  • Yannick Corboz

file2img: small utility that can interpret any binary file as image data

file2img is a small utility that can interpret any binary file as image data, in a variety of pixel formats. It’s useful for looking at file contents in a visual manner, and for extracting usable images from arcane formats.

See repo here.

Lecture slides from Deep Natural Language Processing Oxford University course

There is a Github repo with all the slides from this Machine Learning course: [Deep Natural Language Processing](https://github.com/oxford-cs-deepnlp-2017/lectures

The descripcion of the course is the following (from the Github repo)

“This is an advanced course on natural language processing. Automatically processing natural language inputs and producing language outputs is a key component of Artificial General Intelligence. The ambiguities and noise inherent in human communication render traditional symbolic AI techniques ineffective for representing and analysing language data. Recently statistical techniques based on neural networks have achieved a number of remarkable successes in natural language processing leading to a great deal of commercial and academic interest in the field

This is an applied course focussing on recent advances in analysing and generating speech and text using recurrent neural networks. We introduce the mathematical definitions of the relevant machine learning models and derive their associated optimisation algorithms. The course covers a range of applications of neural networks in NLP including analysing latent dimensions in text, transcribing speech to text, translating between languages, and answering questions. These topics are organised into three high level themes forming a progression from understanding the use of neural networks for sequential language modelling, to understanding their use as conditional language models for transduction tasks, and finally to approaches employing these techniques in combination with other mechanisms for advanced applications. Throughout the course the practical implementation of such models on CPU and GPU hardware is also discussed.”

The course is very complete and is divided into 5 repos: one for the lecture notes / slides, three practical repos that have very well guided assignments with IPython notebooks to get you started on the work. And a finaly repo which is has a couple of alternatives which students cam choose from to continue work.

We usually add a list of links at the end with links related to this

  • [Oxford Deep NLP 2017 course](https://github.com/oxford-cs-deepnlp-2017/lectures This repository contains the lecture slides and course description for the Deep Natural Language Processing course offered in Hilary Term 2017 at the University of Oxford.
  • [Practical 1: word2vec](https://github.com/oxford-cs-deepnlp-2017/practical-1 We will be training word2vec models on TED Talk and Wikipedia data, using the word2vec implementation included in the Python package gensim. After training the models, we will analyze and visualize the learned embeddings.
  • Practical 2: Text Classification TED stands for “Technology, Entertainment, and Design”. Each talk in the corpus is labeled with a series of open labels by annotators, including the labels “technology”, “entertainment”, and “design”. Although some talks are about more than one of these, and about half aren’t labeled as being about any of them! In this assignment, you will build a text classification model that predicts whether a talk is about technology, entertainment, or design–or none of these.
  • [Practical 3: Text Classification with RNNs](https://github.com/oxford-cs-deepnlp-2017/practical-3 In this practical, you can explore one of two applications of RNNs: text classification or language modelling (you are welcome to try both, too). We will be using the training/dev/test splits that we created in Practical 2.
  • [Natural Language Processing [NLP] topic in Github](https://github.com/topics/natural-language-processing A list of repositories hosted on Github abut NLP
  • [The Annotated Transformer](http://nlp.seas.harvard.edu/2018/04/03/attention.html Presents an annotated version of a [paper](https://arxiv.org/abs/1706.03762 which introduces a new simple network architecture, the Transformer, based solely on attention mechanisms, dispensing with recurrence and convolutions entirely which was a novel alternative technique (in 2017) to tackle NLP tasks such as translating text. The annotated version is basically a IPython version of the paper.

Trax: state of the art deep learning library

Trax helps you understand and explore advanced deep learning. We focus on making Trax code clear while pushing advanced models like Reformer to their limits. Trax is actively used and maintained in the Google Brain team. Give it a try, talk to us or open an issue if needed.

The page also recommends Gin-config which is basically a way to create and populate objects via object injection. Sounds interesting.

How to calculate cost of a particular device based on wattage

Most electronic devices come with a specification indicating what is its wattage (how many Watts it consumes). It is useful to understand how this translate to cost in your electric bill. There is a site called [Explorable Physics](https://landgreen.github.io/physics/ which has course notes for algebra based physics course. []The section Power](https://landgreen.github.io/physics/notes/circuits/power/ has a very clean explenation on how to calculate the cost if you know the price of electricity in killowatt hour. Here I copy the information on how to calculate this.

Definition

Power is defined as work done over time. Power measures the rate that voltage sources, like batteries, convert energy into electrical energy. Power could also measure the rate that electrical components convert electrical energy in other forms.

P = power [W, J/s, watt] / W = work, change in energy [J, joules] / Δt = time period [s, second]

Problem

The label on my electric space heater says 1500 watts. This means it can convert 1500 joules of electrical energy into thermal energy every second. How many joules of energy can it add to a room in an hour?

Solution

W = P x Δt = (1500 W) (3600 s) = (1500 J/s) (3600s) = 5400000 J

Power bills in America use a unit called kilowatt hour. This is actually a unit of energy, not power.

(kilo) (watt) (hour) = (1000) (J/s) (3600 s) = 3,600,000 J => 1kWh = 3,600,000 J

Example: How many kilowatt hours of energy would I consume if I ran my 1500 W electric heater at full power for 4 weeks?

Solution

Example: The average price in the United States for 1 kilowatt hour is $0.12. How much would the kilowatt hours from the previous problem cost in dollars?

W = 1008 kWh , Cost = W x ($0.12 / 1 kWh) = $120.96

Feynman’s PhD thesis

I found a great video which summerizes his PhD thesis. You can also download the PDF of his thesis and read it. The author of the video also recommended these notes on Classical Mechanics, Lagrangian and Principle of Least Action and Feynman’s Nobel address

Creating beautiful and engaging infographics and slides

Visme is a content creation tool for making presentations and infographs. They have a lot of resources on their site. I found two presentations they made to be an excellent source of ideas and tips on creating presentations and infographs.

Infographics

A Beginners Guide to Creating Shareable Infographics - PDF

A Beginners guis

A Non-Designer’s Guide to Creating Visually Captivating Presentations - PDF

Upload files to Amazon S3 with a bash script

The other day I was backing up a really old machine that had Centos 5.4. I started going over the Amazon CLI documentation and noticed it was going to be painfull to try to install this on such an old server. My next idea was starting to search for simple S3 client that would allow me to upload files (which the only thing I really needed to do). Somehow I came across this Github gist which is basically a bash script that uses openssl and curl to upload files into an S3 bucket. I run the code but had an error. After a little Googling it turned out it was a security bug in OpenSSL. I updated the OpenSSL library with a version from Centos 5.11 and it worked! So … if you need to upload files to an Amazon S3 with curl and OpenSSL this is it!

#!/bin/bash
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash

S3KEY="[YOUR AMAZON KEY HERE]"
S3SECRET="[YOUR AMAZON SECRET HERE]"

function putS3
{
  path="${1}"
  aws_path="${2}"
  bucket='[YOUR BUCKET HERE]'
  date=$(date +"%a, %d %b %Y %T %z")
  acl="x-amz-acl:public-read"
  content_type='application/x-compressed-tar'
  string="PUT\n\n$content_type\n$date\n$acl\n/$bucket$aws_path"
  signature=$(echo -en "${string}" | openssl sha1 -hmac "${S3SECRET}" -binary | base64)
  curl -X PUT -T "$path" \
    -H "Host: $bucket.s3.amazonaws.com" \
    -H "Date: $date" \
    -H "Content-Type: $content_type" \
    -H "$acl" \
    -H "Authorization: AWS ${S3KEY}:$signature" \
    "https://$bucket.s3.amazonaws.com$aws_path"
}

echo "Uploading [$2]..."
putS3 "$1" "$2"

MVP.css — Minimalist stylesheet for HTML elements

This is something I’ve been searching for a long, long time. Not sure this is the style I like most but the idea is what matters. It’s simple: a CSS file that adds styling to the basic HTML elements without any additional classes. You write a plain and simple HTML file and add the CSS to get a decent experience (much better than the browser’s default). Get it here and whatch a demo here. This is how Google Page Speed will treat you if you use this:

Google Page Speed stats for the example site: 100%

Drupal + AMP Presentation - DrupalCon Seattle 2019

Karen Stevenson, Director of Technology @Lullabot talks gives a talk about the state of AMP in Drupal in 2019. Lullabot have been maintaining the AMP integration since 2016 so she definitely knows how to integrate AMP with Drupal. Check the YouTube video here

First Slide of presentation

Some AMP and AMP Drupal related links:

Drupal Marketing Material

There is a site with a lot of interesting material for marketing purposes on Drupal.org. Here are a couple of useful links

Drupal Branch Book - Brand and logo guidelines 2020

Drupal Brand Book - Branc and logo guidelines 2020 - PDF

A couple of other important links

Keyboard over WIFI with an ESP8266

I have an old computer as a meda center which doesn’t have bluetooh. I want to be able to connect a “wireless keyboard” to it. Since I have an ESP8266 and some time on my hands I want to write a small APP and be able to connect to the computer and send keystrokes to it from my mobile phone. Ideally I wanted to use an ESP32 and Bluetooth. Unfortunately, at the time and to my knowledge, there is no USB support (even low-speed) for the ESP32. So … for the moment the plan is to use this project Software-only ESP8266 USB Device. More to come soon.

Yannick Corboz

Some Yannick Corboz artwork.: French comic artist and illustrator based in London. Much more in his Instagram account

Image 1 Image 2 Image 3