When did tmux get plugins?

Well, this is new to me. Apparently tmux now supports plugins. I don’t really know if I need any plugin, I enjoy tmux as it is right now (after some customizations) but it’s good to know that plugins finally exist for tmux. So, what do we have: First, the Tmux Plugin Manager: https://github.com/tmux-plugins/tpm Next, the tmux Facebook PathPicker plugin (which is a marvelous thing I didn’t knew existed): https://github.com/tmux-plugins/tmux-fpp and https://github. [...]

Analyse and optimize a webpack vuejs bundle

At around 450 kb of javascript code, a Quasar distribution bundle seems a bit too big. The following short recipe applies to an app generated from the Quasar Framework default template, but it probably applies to any vuejs project that uses vue-loader, and even any project using webpack. First, we want to analyse what’s inside the bundle. A good utility is webpack-bundle-analyzer, but how to use it? Configure the webpack to write the stats to a json file. [...]

Loading packages without z3c.autoinclude in Plone 5.1

The new Plone 5.1 development buildout doesn’t include a zcml property in its [instance] section. It is no longer needed, with all eggs already providing a z3c.autoinclude entrypoint. This, unless you want to load an older package which doesn’t have such an entry point. That’s when the trouble starts. Adding a, for example: [instance] ... zcml += cs.auth.facebook doesn’t work. There is really no zcml property in any of the extended cfg file, so Zope will try to load this package first, which will result in a “permission not defined” zcml error. [...]

Using pyramid_jwt with pyramid_multiauth

pyramid_jwt has its own convenience method of registering as an authentication policy, through config.set_jwt_authentication_policy. It does so because the constructor of its policy takes a lot of arguments, so it’s best to trust the package to do its own setup. But this makes it a bit harder to use with pyramid_multiauth, as you can’t easily pass the JWTAuthenticationPolicy policy to the multiauth.policies setting. Turns out that is not hard at all. [...]

Installing node with NVM

This is more of a recipe for myself, as I always have problems with npm. I’m usually stuborn and refuse to use a globally installed nodejs, and can’t be really bothered to properly install a nodejs tarball distribution, with setting up PATH and all. They’re usually throw-away and not portable between my machines. So, a simple recipe to install nodejs on my own setup, an ArchLinux machine using fish as default shell. [...]

Test for an interface provided by object in plone action condition

Quick tip: how to test if the context provides an interface, with an expression set as the condition: python:object.restrictedTraverse("@@plone_interface_info").provides('dotted.path.to.IMyFancyInterface') [...]

Plone: assign permission to role

I always forget, and a quick search through the eggs folder didn’t yield anything easy to find: how to I assign a permission to a role, in a context? This is a bit of code: from Products.DCWorkflow.utils import modifyRolesForPermission from AccessControl.PermissionMapping import getPermissionMapping perm = 'Delete objects' pm = set(getPermissionMapping(perm, context, st=tuple)) pm.add('Contributor') pm.add('Owner') modifyRolesForPermission(wc, perm, tuple(pm)) This is based on code found in DCWorkflow. I know, the proper code would be: [...]

Python packaging vs npm

I admit, Python packages are a bit more difficult to understand, for a newbie. I have witnessed this problem a lot, lately, when dealing with new people trying to learn the Python development process. There is a mountain of information that needs to be climbed, to understand Python packages: the namespace concept the matter of OS security the full cycle of an application, from development to deployment and maintainance And this are just basics, in addition to the distutils/setuptools/virtualenv/pip or zc. [...]

Generate the route url for a Cornice service or resource

As far as I can tell, there’s no documentation on how to generate the reverse url for a Cornice resource or service. Suppose I want to publish a list of children resources and i want to make them behave as linked data. For that, I want to be able to generate proper URLs, based on the request URL. This is some sample code to show how to achieve that, based on a side project I’m working on: [...]

Another way to index category labels in categorization tasks

One common task in machine-based categorization tasks is to relabel data with a numeric value, an index, where before that data was labeled with a string. The basic Python code would be something like this: label_index = {} labels = [] for l in string_labels: if l not in label_index: label_index[l] = len(label_index) labels.append(label_index[l])> While writing that bit of code from above, I realized that a word tokenizer can do the same thing. [...]