Ludochaordic
Fantaisies programatico-ludiques

Traduction du Temple du Non, une histoire interactive Twine du studio Crows Crows Crows

Crows Crows Crows est un studio de jeu vidéo créé en 2015, à l'origine entre autres du jeu complètement déjanté Dr. Langeskov, The Tiger, and The Terribly Cursed Emerald: A Whirlwind Heist et le créateur du studio, William Pugh, est également un des auteurs de The Stanley Parable. En 2016 …

Read More

Displaying chained exceptions stacktraces in Python 2

At work we have a component not yet migrated to Python 3, and we recently had some difficulties diagnosing a problem with the MySQL connector. Because we were catching the mysql.connector.errors.Error and raising a custom exception, we were loosing the underlying stacktrace and hence couldn't troubleshoot the …

Read More

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

Conference sur l'open source en entreprise a l'Ecole IMT Atlantique

Une courte présentation que j'ai donné ce matin à l'école d'ingénieurs IMT Atlantique (ex Ecole des Mines) via oui.sncf : (la navigation est meilleure avec les flêches gauche / droite du clavier) Iframes non supportées. Cliquez sur le lien dans le paragraphe ci-dessous pour accéder directement aux slides. Le code source …

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

Certification développeur RGAA Access42

Connaissez-vous l'accessibilité numérique ? En très bref: L'accessibilité numérique est la mise à la disposition de tous les individus, quels que soient leur matériel ou logiciel, leur infrastructure réseau, leur langue maternelle, leur culture, leur localisation géographique, ou leurs aptitudes physiques ou mentales, des ressources numériques. Pour plus de détails …

Read More

Compte-rendu de la PyConFr 2017

Cette année, voyages-sncf.com m'a permis d'aller à la conférence annuelle Python à Toulouse. En vrac, voici un petit résumé personnel de cette PyConFr. J'y étais présent 3 jours sur 4 (sprint le premier et conférences les deux autres), et j'y ai donné donné 2 présentations, dont le contenu est …

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

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

Solarized mindmaps with Python and graphviz

This week I wrote a small Python script, that can generate a mindmap from a simple indented text input like this: Winter december january february Spring march april may Summer june july august Autumn september october november The command: ./graphviz_mindmap.py seasons.txt. The results, with various layout parameters: Another …

Read More

Analyse statique de code Java : Google Error Prone, Findbugs et PMD

Ce court article détaille comment mettre en place simplement 3 analyseurs de code statique avec Maven. Contexte Au sein de mon équipe à Voyages-Sncf, le nombre de composants Java est en train d'augmenter. Nous avons déjà toute une batterie de tests pour valider notre code, ainsi qu'un Sonar en place …

Read More

Intro à Python & les frameworks web

Le mois dernier j'ai rapidement présenté le language Python et les frameworks web existants à mon équipe à Voyages-Sncf.com. Les slides sont accessibles ici, ainsi que les sources Markdown pour Reveal.js. Iframes non supportées. Cliquez sur le lien dans le paragraphe au-dessus pour accéder directement aux slides. Il …

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

Visualisation des votes sur republique-numerique.fr

Quelques essais de visualisation de données pour célébrer la fin de cette expérimentation de débat citoyen en ligne. Première tentative, utilisant Charted, pour visualiser la répartition des nombre de votes toutes propositions confondues : Exemple de lecture de ce graph: 33 propositions ont reçu exactement 8 votes positifs. Ce graph n'apporte …

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

youtube_playlist_watcher

Depuis plusieurs années, je ruminais contre Youtube: chaque fois qu'une vidéo est supprimée d'une playlist (parce que l'utilisateur qui l'avait uploadé l'a supprimé par exemple), son nom n'est même pas conservé, seul un lien mort persiste dans la liste. Et la seule solution est alors de googler le nom de …

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

Le centre de la France selon Google

C'était la prise de conscience rigolote de ce matin :) Petite explication: plusieurs des services web de géolocalisation gracieusement fournis par Google utilisent la même interface (API). Cette interface requiert de définir une "zone de travail" géographique dans laquelle on va ensuite pouvoir interroger Google sur des adresses, des itinéraries, etc …

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