Tag: Linux
Creating and Applying Patches
Use diff and patch to create and apply patches to files
The POSIX diff
, cmp
and patch
commands are very versatile. Sometimes, you need to edit a part of a file and send only your changes to somebody else to apply. This is where these handy commands can help. This post describes concisely how to use them to compare files, create patches and apply them.
MangoHud and Java
A little tip to launch Java programs directly from your IDE using MangoHud
MangoHud is an overlay for monitoring frame rates, frame times, temperatures and CPU/GPU loads on Vulkan and OpenGL applications in Linux. It is also the default performance overlay used in the Steam Deck, and it is awesome.
I know the amount of people using Java for high performance graphics is not very high, but they are there, of that I’m sure. I’m actually one of them. Gaia Sky is written in Java, and even though it has its own rudimentary debug overlay, MangoHud goesfar beyond it. When I’m not editing in neovim, I use IntelliJ IDEA CE to do a little refactoring and deubgging. It is during these times that being able to run the JVM with MangoHud directly from the IDE comes in handy. But most IDEs do not allow customizing the launch command directly to use the mangohud /path/to/app
approach, so how do we do it?
Libvips Is a Good Image Processor
Libvips' resource usage and speed are unmatched, especially compared to ImageMagick.
Edit (2023-04-05): Added some suggestions by the author/developer of libvips.
Today I discovered libvips, a command line utility and library to manipulate and process images, and I am impressed. I’ve been using ImageMagick and its fork, GraphicsMagick, for as long as I have had to process images from the CLI, and they work well for moderately-sized images. But lately, I have been preparing virtual texture datasets for Gaia Sky and the sizes of my images have increased exponentially. Right now I’m processing 64K and 128K images on the regular (that is 131072x65536 pixels), and ImageMagick just can’t do it reliably. It uses so much memory that it can’t even split a 64K image in a 32 GB RAM machine without running out of it. Running it with the suggested options to limit memory usage (--limit memory xx mb
, etc.) and use a disk cache never works for me. It just produces blank images for some reason. So after implementing a couple of Python scripts based on OpenCV and NumPy to do some basic cropping, I took on the task of finding a proper, capable replacement. And found it I did. Libvips is the perfect tool, it seems. Based on my few first tests, it performs much better than ImageMagick and GraphicsMagick. It is super fast and never seems to use much memory, no matter how big an image I throw at it.
Trying Out Sway and Wayland
Is Wayland ready for prime time yet? Find out here.
Wayland is a modern display server protocol that will eventually replace X11. It is still not quite a hundred percent there, but it has been improving steadily and gaining ground over the past years. It is expected to become the new default display server on Linux systems at some point in the near future… Whatever near means in that context.
This past weekend I had some time to play around with Sway, a window manager and Wayland compositor that mimics i3. How did it go?
Use Syncthing to Synchronize Your Files
Forget about third-party cloud solutions that invade your privacy
These days almost everyone uses services like Dropbox or mega.nz to store their important files and have them accessible wherever and whenever they need them. I’m told it is not uncommon to use these external services to back up all one’s files, from photos to sensitive and private documents. Well, good news. If you actually care about your files and feel uneasy to have them all in other people’s servers, you may want to have a look at Syncthing, an open source and free (as in free beer) continuous file synchronization program that synchronizes your files between your computers without being stored or ever going through third parties. In this post I’ll talk about how it works and how to set it up to sync directories between your computers, laptops and phones.
Upgrade Your Old RSA SSH Key to Ed25519
The RSA algorithm has some problems and you should update to Ed25519
If you work regularly with remote machines or use online services like Gitlab, you are probably using an SSH key. And if you have not updated it recently, chances are you are using an RSA key, or, god forbid, an ECDSA or DSA key. Well, bad news: in order to be on the safe side, you should probably upgrade. A presentation at BlackHat 2013 reported significant advances in solving the problems on which DSA and some other key types are based. The presentation suggested that keys based on elliptic curve cryptography (ECC) should be used instead: ECDSA or Ed25519. Additionally, ECDSA and DSA have nasty additional issues, so you should probably just stick to Ed25519. Here’s how to upgrade.