Ludochaordic
Fantaisies programatico-ludiques

Python module imports visualization

flask httpie requests simplejson botocore scrapy docker-compose ansible What are those diagrams ? They show dependencies between the internal modules of various well-known Python libraries. They goal is to provide a global overview of a Python project architecture, as a map of modules & packages, the top-level code abstractions. Note that all …

Read More

Glitch art and image processing with Python

This one above reminds me of The Great Wave off Kanagawa. Like many …

-->

This week I discovered the fantastic glitch art Reddit community (for a little more context on glitch art, wikipedia has a page). These are the pieces I love the most (click on them to find the source): This one above reminds me of The Great Wave off Kanagawa. Like many …

Read More

Free alerting-as-a-service drop-in replacement for mail command

On my personnal server, I used to send myself alerts by email using the handy standard mail command. However, recently it appeared that my server became categorized as "spammer" by some online service providers, due to the alerts frequency (a little bit more than one per day). Hence, I got …

Read More

Daniel Linssen latest wonderful games

Daniel Linssen, aka managore, is a fantastic indie game developer. I already mentioned one of his games, HopSlide, in a previous blog post (FR). Now that it's clear that I am totally unbiased about this incredible game maker, lets talk about his latest games ! WalkieTalkie This first one simply amazes …

Read More

Extracting setup_requires dependencies out of a setup.py

I ended up not using this code, but it may be useful to others: mock_setup_provider.py: import sys from unittest.mock import Mock class MockSetupProvider(Mock): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.captured_setup_requires = set() def setup(self, *args, **kwargs): self.captured_setup_requires.update(kwargs.get('setup_requires')) setup_extractor …

Read More

Is there any equitable dumbphone or laptop out there ??

Hello all. This is an open request : does anyone know about equitable non-smart phones or laptops, ideally long lasting and for the laptops: easily repairable with open-source componants ? I know about Fairphone, but I couldn't find anything similar for simpler "feature phones". By the way, I stumbled upon their cost …

Read More

JSONP & exceptions with Spring web 4

Since Spring 4.1, it is really easy to enable JSONP on an API controller: @RestController @RequestMapping(value = "/") public class MyController { @ControllerAdvice static class JsonpAdvice extends AbstractJsonpResponseBodyAdvice { public JsonpAdvice() { super("callback"); // name of the query parameter to use } } @RequestMapping(value = "/", method = RequestMethod.GET) public MyAPIResult getStuff(...) { ... } } There is no RFC …

Read More

Python gevent terrible failure mode under Windows

What do you think of the following innocuous Python code ? from gevent import monkey monkey.patch_all(thread=False, select=False) import requests requests.get('http://i-do-not-exist.com') print('THIS WILL NEVER BE PRINTED !!!') Guess what ? The string message will never get printed :( Simply remove the monkey.patch_all line and you'll …

Read More

Rendering deep text-based mindmaps with WiseMapping and Python

In this blog post, I'm going to demonstrate how to reuse WiseMapping HTML+JS rendering engine to easily visualize... text-based mindmaps like this one have many benefits they are readable as-it-is they don't require any tool to be edited they follow the UNIX tenets For the impatient ones, here is …

Read More

Solving a painful browserify limitation : portable source files selection with a wildcard pattern

In any UNIX shell, the following will always work out of the box: browserify src/main/lib/js/*.js > out-bundle.js But of course, not under Windows. And browserify does not accept directory names as primary parameter, nor wildcard globbing patterns. There is a pending issue & pull request aiming to …

Read More

Fixing fonts that raise a &DFLT table doesn't satisfy the spec. LangSysCount is not zero& error in Firefox

Did you ever got this infamous error message in Firefox debug console (with CSS error messages enabled) ? downloadable font: Layout: DFLT table doesn't satisfy the spec. for script tag DFLT (font-family: "MyBeautifulFont" style:normal weight:normal stretch:normal src index:1) source: http://W.X.Y.Z/fonts/myfont …

Read More

New release for genealogic-d3

A year ago, I built a small JS lib using D3.js to visualize JSON-defined genealogy trees. At the beginning of the year, I added a new feature using flex-calendar and moment-ferie-fr : a birthday calendar using the same JSON genealogy definition and miniature images. I added this calendar to the …

Read More

Generating SRI hashes with grunt-usemin

I'm not really crazy about Yeoman's grunt-usemin : I find painful the way it enforces a unique pipeline, with its preliminary useminPrepare task and :generated targets. But on the project I'm working on, we made the choice to use it early on, and we're sticking with it for now. And this …

Read More

Colored diff output with Python

Say you are generating a colored diff output with the standard difflib Python package: diff = difflib.ndiff(file1_lines, file2_lines) print('\n'.join(diff)) Now, I'll show you how to write a simple color_diff function that you can use to color your diff like this: diff = difflib.ndiff(file1_lines, file2_lines) diff …

Read More

Disabling error stack traces with SpringBoot, but only in prod

Simply add the following class to your project. It will be automatically registered at start-up if you use the @EnableAutoConfiguration annotation : @ControllerAdvice // Makes this the default behaviour of all controllers @ConditionalOnProperty(prefix = "app", name = "disable-default-exception-handling") class GlobalControllerExceptionHandler { @ExceptionHandler(Exception.class) // Catch any exception @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) // Returns an error code …

Read More

Citations : comédiens & Terror Network

Deux lectures complètement décorellées à partager: Aujourd'hui, pour justifier leurs [les comédiens] droits, on parle d'économie. En 2004, le rapport Guillot remis au ministre de la culture et de la communication,dans l'émotion suscitée par l'annulation du festival d'Avignon, souligne qu'en 2003 "la valeur ajoutée dégagée par le secteur du …

Read More

Quickly finding where you PHP script is stuck

First, install PHP debugging extensions for gdb, for example: debuginfo-install php-5.6.8 # if you use yum aptitude install php5-dbg # if you use aptitude Then simply: php_version=5.6.8 php_script_pid=$(pgrep -f $php_script_name) curl https://raw.githubusercontent.com/php/php-src/PHP-$php_version/.gdbinit >> ~/.gdbinit gdb -p $php_script_pid dump_bt executor_globals …

Read More

Solving BeanCreationException: Error creating bean with name 'entityManagerFactory'

I've lost quite some time on this error recently : Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: org.hibernate.jpa.boot …

Read More

AngularJS console debugging tips + pre-commit hooks

Just some handy accessors for the brower console : var myScope = $('#directive > select.or').scope() var $rootScope = $('body').scope() // if has the 'ng-app' attribute var myController = $('#directive > select.or').controller() var injector = $(document.body).injector() var myService = injector.get('myServiceName') And there are 3 handy pre-commit hooks : - repo: local hooks …

Read More

God I hate Java Regex API

Pourquoi, mais pourquoi faut-il 3 lignes en Java pour juste extraire un groupe d'une expression régulière qui "match" ??? Matcher matcher = Pattern.compile("o?k(b|i)s+").matcher("kiss"); matcher.matches(); assert matcher.group(1) == "i"; En Python: assert re.match("o?k(b|i)s+", "kiss").group(1) == "i …

Read More

Django tips & tricks

I recently worked on a short website project using Django & Heroku. It was my very time using this Python framework, and I really liked it ! This is a compendium of tips & tricks that I, as a Django beginner, found quite useful : Django enhanced shell To install it : pip install django-extensions …

Read More

Convert source code to PDF with syntax coloring

Sometimes, it's useful to print some source code on paper. And PDF is a very common file format, that you can be sure your printer will accept, and that will let you preview the final page layout. But how to quickly perform syntax-coloring and export to PDF ? I've been experimenting …

Read More

Cross-browsers testing : zuul or sauce-tap-runner to replace testling by SauceLabs ?

Since July 2014, Substack great cross-browsers testing tool testling has been unavailable. Today I was looking for an alternative to use with ecovoit, my carpooling search engine. Saucelabs is a very interesting solution, and is free for open-source projects. Now I found 2 tools to easily launch your Javascript TAP …

Read More

Replicating PHPSESSID and srctoken session authentication with mitmproxy

A month ago, I wanted to automate queries to a website that is using the PHPSESSID cookie to keep track of sessions. I struggled a lot and couldn't find any documentation covering the behaviour I was observing. But yesterday I finally found a solution ! In hope it could help others …

Read More

Python 3 non consistent set & dict iteration gotcha

Consider the following Python expression: print("".join(set("ABCDE"))) What do you think it produces ? Not necessarily "ABCDE". Right, but you would expect the result to be consistent, isn't it ? $ for i in {1..3}; do python2.7 -c 'print("".join(set("ABCDE")))'; done ACBED ACBED ACBED Great ! ... But with …

Read More

Mimicking testling HTML rendering of TAP javascript tests

This post is only relevant to you if you use browserify. For a good introduction to this powerful Javascript bundling tool, check this doc. First of all, I'd like to take my hat off to James Hallyday and Peteris Krumins who have built such amazing tools as browserify, testling and …

Read More

Genealogy tree visualization with d3.js

I'm happy to introduce you with genealogic-d3, a Javascript visualization library to nicely display genealogy trees that I've been working on during the past 3 days. I'm quite satisfied by the result. You'll find a live demo you can play with at https://chezsoi.org/lucas/genealogic-d3/skywalker.html I …

Read More

Fun with Javascript string obfuscation

Inspired by this tweeter post by Marcus Lagergren and the JS1K competition, here is a valid Javascript code snippet for you obfuscated code lovers: ー=!+[]+!+[]+!+[]+!+[],ߺ=ー+ー,ǀ=ߺ+ߺ,ꓹ=!+[]+[],ǃ=!+[]+!+[]+!+[],ᚐ=ꓹ[+[]],ꓹ=ᚐ+ꓹ[ǃ]+(![]+[])[ǃ]+ᚐ,ᚐ=/,/[ꓹ]+[],ꓹ=ǀ+ߺ+!+[]+!+[],ꓹ=ᚐ[ǃ]+ᚐ …

Read More

Setting-up Etherpad in a server subdirectory -aka- Apache config hell

I truly think Etherpad is an amazing piece of software. Not so much for its code base quality than for its extraordinary range of usages. Now, while I'm still unsure if todo-lists are useful or a complete waste of energy, I'm convinced that keeping a developer logbook / diary / journal has …

Read More

Bash remote code execution vulnerability

Just relaying the information about this "ShellShock" vulnerability: RedHat security blog post the full disclosure on seclists.org This seems to affect Apache, sshd, DHCP clients and even potentially git. TL;DR here is how to check your Bash version env x='() { echo Never called; }; echo YOUR BASH IS VULNERABLE …

Read More