Ссылки о веб-разработке за июнь 2022

Terminal Tip ‘duf’ is Prettier Alternative to the ‘df’ Command

I wouldn’t call myself a command line ninja but I do have a soft spot for getting things done using a CLI.

At the end of 2021 I wrote a list of the best command line apps I use on the regular. In that rundown I spotlighted btop, a powerful and engaging alternative to top, and intro’d ncdu, an awesome, interactive replacement for the regular du command, written in Ncurses.

This week I came across a similarly flashy “replacement” for another command that I use from time to time: df.

Df is a command line basic that relays file system disc space usage on a(ll) drive(s). There are ample options you can pass to Df to tailor the output to your needs (something the df man-page will walk you through better than I can):

But it could be better.

Duf is a Neat Df Alternative

Enter Duf (Disk Usage/Free Utility). This command-line tool pitches itself as “a better df alternative” and, for my needs, it is.

Don’t get me wrong df is good at what it does, but it’s also very utilitarian. The way duf presents information is more ordered and more intelligible at-a-glance (at least it is to me).

I can’t help but find the output from duf (above) easier to parse than the terse tabulation returned by a vanilla df command. You’d think that by showing me more information off the bat it’d be hardware to find the information I need. And yet… The exact opposite.

What’s great is that it is easy to install ‘duf’ on Ubuntu 22.04 LTS:

You can run it just as easily:

Remember: duf can be as concise or as expansive as you need. If you pass it the --all option it goes from short and sweet to very looong:

Run duf --help to get a full overview of everything it can do, or stop by its Github page to learn more, say thanks, or log any issues you have while using the tool.

Summary

Will switching to Duf change the way people use their computer? Hah, no. But I do find it to be a nice crutch for the few times I need (and sometimes just want) to look at amount of free space on my mounted file system(s).

Try it out and let me know what you think!

In Defense of Blocks to Create Localized Scope

— Kyle Simpson (of YDKJS fame) pops up to give his thoughts on a recently popular article about using ‘block statements’ to group code together which attracted some criticism. In short, Kyle’s a big fan of the approach.

Vitest: A Vite-Powered 'Blazing Fast' Unit Testing Framework

— Brings a lot of cool stuff into one place and really is quick – if you want near instant feedback when you change your code, check it out. You get Vite’s transformers, resolvers, and plugins, snapshot testing, native code coverage, component testing, an instant watch mode, and more.

WebContainers Now Supported in Firefox on Desktop and Android

WebContainers is a ‘full stack’ Node.js environment that runs entirely within the browser built by the folks at online IDE StackBlitz. It’s worked in Chrome since launch a year ago, but now collaboration with Mozilla has brought it to Firefox too.

Mozilla releases local machine translation tools as part of Project Bergamot

In January of 2019, Mozilla joined the University of Edinburgh, Charles University, University of Sheffield and University of Tartu as part of a project funded by the European Union called Project Bergamot. The ultimate goal of this consortium was to build a set of neural machine translation tools that would enable Mozilla to develop a website translation add-on that operates locally, i.e. the engines, language models and in-page translation algorithms would need to reside and be executed entirely in the user’s computer, so none of the data would be sent to the cloud, making it entirely private.

In addition to that, two novel features needed to be introduced. The first was translation of forms, to allow users to input text in their own language that is dynamically translated on-the-fly to the page’s language. The second feature was quality estimation of the translations where low confidence translations should be automatically highlighted on the page, in order to notify the user of potential errors.

This set of requirements posed a number of technological challenges to the team: the translation engine was entirely written in programming languages that compile to native code. We needed a way to streamline the distribution of the project in order to avoid the overhead involved in providing builds compatible with all platforms supported by Firefox — that would be impracticable to scale and maintain. Also, the engine needed to perform fast enough on CPUs and not rely on GPUs like is traditionally required by deep learning solutions.

Our solution to that was to develop a high-level API around the machine translation engine, port it to WebAssembly, and optimize the operations for matrix multiplication to run efficiently on CPUs. That enabled us to not only develop the translations add-on but also allowed every web page to integrate local machine translation, like in this website, which lets the user perform free-form translations without using the cloud.    

The translations add-on is now available in the Firefox Add-On store for installation on Firefox Nightly, Beta and in General Release. We are looking for users’ feedback and in the add-on, you’ll see a button to fill out a survey that will help Project Bergamot collaborators understand which direction we should take the product. 

To empower the community to contribute with new languages we also developed a comprehensive training pipeline to allow enthusiasts to easily train new models, helping expand the add-on reach. 

This work aligns with Mozilla’s commitment to keeping the web accessible to everyone regardless of their language while also building open-source projects of value to our community with a focus on privacy. Please join us and send suggestions — we need all of your voices to make this add-on truly accessible for all. 

This project has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 825303 🇪🇺.

← предыдущий месяц