Phaengris.Art hand-drawn arts, city photos, linux / dev stories

How to Use Yjs in Rails With Importmap

Yjs is a CRDT (Conflict-free Replicated Data Types) implementation in JavaScript.

What it means is when you want many users work on the same document, permanently adding, updating, deleting parts of it, CRDT is what you need to synchronize document content between all of the users, automatically resolving conflicts between their editings.

Yjs provides a Ruby port and even an ActionCable-based adapter so users of your Rails application can enjoy collaborative editing using an ActionCable websocket connection.

Unfortunately at the moment of writing this Yjs is not so well suited “out of the box” to be used with importmap, which become a standard since Rails 7. Below is my (kinda hacky) recipe how to make it work.

Read more…

Embed Custom Fonts Into PDF Documents With Ruby and Puppeteer

When you need to build a PDF document from HTML, Puppeteer is the tool to use.

But things are not so obvious when it comes to custom fonts.

Read more…

Install Torch.rb on Linux

The process is simple but not without it’s pitfalls. Here’s the instruction how it worked for me. My system is Fedora Linux 38, but I believe it should work for other Linux distros as well.

Read more…

Street Art on Electrical Boxes in Sofia

In Sofia street electrical boxes are often decorated with some art. A good way to improve the city spirit.

A street electrical box decorated with a picture of a humanoid cat with a backpack, with a forest-like background A close-up fragment of a street scene is visible, featuring a green fence, asphalt, and two electrical boxes, one only partially in view. The central electrical box is adorned with a mural that depicts a forest setting, including several trees, a couple of clouds, and a mountain in the background. Superimposed on this natural scene is a humanoid cat character gazing at the viewer, equipped with a backpack. The cat is wearing a helmet-like hat emblazoned with the 'AC/DC' logo and clutches a mountaineering hammer in its left paw. Below the cat, there is a text in Bulgarian, 'Аз ♥ Витоша' (transcription: 'Az ♥ Vitosha'), which translates to 'I ♥ Vitosha'. A street electrical box decorated with a picture of a medieval monarch, probably the Bulgarian tsar Simeon I the Great A fragment of a street is depicted, with an electrical box in the foreground. The background is predominantly occupied by a garage door adorned with large, unreadable graffiti. The top right corner reveals a glimpse of another street, with a couple of buildings and cars visible. The electrical box features a portrait of a medieval monarch dressed in a green robe and red cape, wearing yellow armor on his chest and right shoulder. His face is half-hidden beneath white hair and a beard. Holding a scepter in his right hand and a paper scroll in his left, he gazes at the viewer with a serious expression. A street electrical box decorated with a picture of three birds composed from various geometric colorful shapes A very close-up fragment of a street scene is captured, with an electrical box occupying most of the picture, closely surrounded by the green leaves of a creeper plant. The box is adorned with a picture of three birds, abstractly drawn using various geometric shapes in multiple colors, set against a sky-like vivid blue background. The birds are perched on tree branches and appear to be communicating with each other in a friendly manner. A label attached to the top left part of the box reads 'Не пипай! Опасно за живота!', (transcription: 'Ne pipay! Opasno za zhivota!') which translates to 'Don't touch! Dangerous for life!' A street electrical box decorated with a picture of three cats, two black and one white, on an abstract wave-like background A close-up of a street scene shows an electrical box next to a massive concrete wall corner, situated above pavement made of hexagonal tiles. The box is adorned with a picture of three cats, depicted in a cartoon-like style: a white cat sitting on the right, a black cat sitting on the left, and another black cat standing at the top center. The cats gaze at the viewer with friendly expressions. The background features wave-like forms in red, white, and gray colors. At the top right corner of the box, a label is attached, reading 'Не пипай! Опасно за живота!' (transcription: 'Ne pipay! Opasno za zhivota!'), which translates to 'Don't touch! Dangerous for life!' A street electrical box decorated with a picture of a large Saint Bernard dog on a city-like background A very close-up view of a street scene features an electrical box in front of a white wall, adjacent to a narrow glass door advertising a street food restaurant. The box is adorned with a picture of a large Saint Bernard dog in a lying pose, its body oriented towards the viewer, and its gaze directed upwards. Next to the dog, a piece of meat is depicted, complete with rising hot smoke. Behind the dog, a town-like background is visible, showcasing several low-rise houses and a cow sporting a modern haircut with curlers. The text on the top of the box reads 'Бос Ларо Градска легенда' (transcription: 'Bos Laro Gradska legenda'), translating to 'Bos Laro City legend.' On the top right of the box, a warning label is attached, reading 'Не пипай! Опасно за живота!' (transcription: 'Ne pipay! Opasno za zhivota!'), which means 'Don't touch! Dangerous for life!' A street electrical box decorated with a picture of city composed from several high floors buildings of different colors A very close-up view of a street scene is captured, with an electrical box in the foreground, situated next to a metal door fashioned in an ornamental style. The box is adorned with an image depicting a city skyline, featuring several high-rise buildings in various shades, predominantly blue and dark blue, with red accents. These buildings are rendered in a simplified, abstract manner, each dotted with numerous small windows in light blue, yellow, and red. Scattered throughout the cityscape are whimsical elements, such as a bird perched on a roof and a prominent bell tower. An electrical box decorated with a picture of a sitting human covering / holding their head with both hands A very close-up view of a street scene captures an electrical box in the foreground, set against a dirty wall covered with unreadable graffiti. On the box, a human figure is depicted sitting on the ground, turned towards the viewer. The figure is covering its head with both hands in a gesture of frustration or despair. The artwork is rendered in a rough, almost abstract style, using a blend of dirty brown and gray colors. Notably, the person is depicted without a face. A street electrical box decorated with a picture of domestic animals in cages A close-up view of a street scene showcases an electrical box situated in front of a small shop's window, which displays a variety of cups in different designs and colors, enticing potential customers. In the foreground, a segment of the pavement is occupied by a service hatch comprised of two concrete plates. The box is embellished with a cartoon-style depiction of several domestic animals, primarily cats and dogs, of varying sizes and colors, all portrayed inside cages. A large label on the right side of the box reads 'ADOPT! НЕ купувай. ОСИНОВИ!' (transcription: 'ADOPT! NE kupuvay. OSINOVI!'), translating to 'ADOPT! DON'T buy. ADOPT!' A street electrical box decorated with a cartoon-like picture of a human in a suit and with large orange head The scene captures a portion of a building featuring a door and two windows, each entering only partially into the field of view. In front of the building lies a pavement dotted with several border poles. On the right side of the scene, an electrical box is present, entirely adorned with a mural of a human figure. This figure is rendered in a cartoon-like style, wearing a suit, and has a disproportionately large orange head, making up two-thirds of its body, with a violet nose and eyebrows. It gazes at the viewer with a smile. A street electrical box decorated with a picture of a window opening a view to an ocean-like background A close-up of a street scene features an electrical box as the dominant element, snugly surrounded by decorative plants. In the background, a building with large glass windows is discernible. The box is decorated with an image of a half-open glass window, through which an oceanic scene is visible. This picturesque view includes palm trees, a vivid blue sky dotted with a few clouds, and waves approaching the viewer. A street electrical box decorated with a picture of a steel drink can represented as a four legged animal The image depicts a creative piece of street art on an electrical box at an urban corner, near a yellowed building wall and a sidewalk with tactile paving. The artwork portrays a whimsical, quadrupedal creature resembling a steel drink can, interpreted in an abstract style. This artistic expression adds a touch of imagination to the everyday street scene, inviting onlookers to find novelty in common urban objects.

Under an Old Maple

Sketched from life in South Park (Yuzhen Park) of Sofia, Bulgaria.

A black and white sketch of a park scene, with a group of people sitting under a large maple tree

Him and His Dog

No, honestly, the goal was not to draw any specific person / scene, but when you start dropping lines one by one on the sketch, they may become anything or anyone, and then you find yourself crafting a story around them.

A black and white sketch of a man and his dog, with citylike background behind them

Autumn sky above Sofia

From bike and foot travels around Sofia. Autumn sky may lack colors, but still be pretty expressive.

Storm clouds gathering above a cityscape with a pedestrian crossing signal and an elevated metro line The photo shows a dramatic sky with dark, ominous clouds overhead. A large, unique cloud formation, resembling an anvil, dominates the scene above a pedestrian crossing signal and the curved, translucent roof of an elevated metro line. The metro line leads towards a cluster of modern buildings visible in far background. High-rise apartment buildings under a dark, stormy sky The photo shows a brooding sky filled with layers of grey clouds, suggesting an imminent storm. Below the heavy sky, a series of high-rise apartment buildings stand in varying shades of grey, their facades showing the wear of time. The buildings, stark against the turbulent sky, overlook a dense copse of trees, adding a touch of life to the urban landscape. Birds flying above an apartment building under a cloudy sky The photo presents a dramatic sky, with dark clouds that appear almost fluid, swirling above an apartment building's rooftop. A flock of birds is captured in mid-flight, silhouetted against the stormy backdrop, adding a dynamic contrast to the stillness of the building. The building itself seems to anchor the scene, its straight lines and solid form juxtaposed with the organic, roiling shapes of the clouds above. Overcast sky with scattered clouds above urban apartment buildings The photo depicts a layered sky, where a massive, dark cloud hovers over a mix of residential buildings. The tallest building, a multi-storied apartment complex, stands prominently in the foreground, flanked by shorter, colorful structures. The clouds, ranging from wispy to dense, create a textured tapestry above the urban skyline, hinting at the changing weather. An elevated metro line and a street lamp under swirling cloudy sky A vast expanse of undulating grey clouds stretches across the sky, heralding the approach of dusk. Below, an elevated metro line with a teal, arched roof, snakes its way through the lower part of the frame. Street lamps stand sentinel along the pathway, their unlit forms waiting for nightfall to fulfill their purpose. Construction crane rising against a backdrop of gray clouds A gray sky, subtly textured with cloud formations that resemble smooth brush strokes, is dominated by a large, dark, stormy cloud covering the entire right side of the frame. A towering crane stands in the middle, a solitary sentry against the expanse of the sky. The colored rooftops of residential buildings peek out from the bottom edge of the scene. Construction crane and apartment buildings under a cloudy sky The image is dominated by a tumultuous grey sky, with swirling clouds that convey a sense of impending gloom. Below the tempestuous heavens, the skyline is punctuated by the angular silhouettes of residential buildings and the linear geometry of a construction crane. The overcast light casts the urban scene below in mutedtones, creating a tableau that is both ordinary and ominously beautiful. Evening sky with industrial buildings silhouetted against a gradient of sunset colors A large, scattered formation of gray clouds tears across the sky to the left, revealing a tranquil expanse of blue above. Serene, white clouds, smooth as brushed strokes, flow across this peaceful backdrop. Below, two sizable segments of industrial structures, with their stark right angles, juxtapose the natural fluidity of the sky. Autumn sky above Sofia Autumn sky above Sofia

Manage Monitor Brightness in Linux With a Shell Script

Managing brightness with monitor controls is a pain. You’re lucky if you have a dedicated button or wheel right on the monitor to do that. Otherwise you have to find that tiny button somewhere under the thing and, well, do with it what you have to do. Repeat for the second monitor if you have any.

Giving that, the idea of using Meta + sound level wheel to regulate the brightness right from the keyboard was unevitable. Yep, you can do that in Linux, but of course in a Linux way, scrathing your head till a suitable bash script is born.

Read more…

Switch KDE Activities With a Bash Script

Yes, there’s this Activity Manager panel on the left, but I hate it there. On my 32:9 it is too far to reach. One may say that a true Linux person shouldn’t move hands away from keyboard at all 😄 but well, we all have our ways. I, for one, prefer a nice set of icons right on my autohiding panel in the middle of the screen. That’d be possible with a bunch of application links in ~/.local/share/applications/, making them refer to some script which would switch activity by name.

Read more…