Language Selection

English French German Italian Portuguese Spanish

Programming Leftovers

Filed under
Development
  • I built my own camera with a Raspberry Pi 4

    The Raspberry Pi is a super tiny computer that is highly programmable. People have used these to program everything from smart mirrors, to portable arcades, to COVID-19 case counters, and even super smart, super techie greenhouses. They are tiny boxes that — if you know how to code — can do pretty much anything.

    For my build, I used the $50 HQ Camera Mod, a Raspberry Pi 4 computer, a USB-C portable 10,000mAh charger, a 3.5-inch touchscreen, jumper wires, a mini push button switch, the body of a Ninoka NK-700 35mm camera, and two vintage C-mount lenses.

  • Customizing my Linux terminal with tmux and Git

    I use tmux, a terminal multiplexer technology, to manage my terminal experience.

    At the bottom of the image above, you can see my green tmux bar. The [3] at the bottom indicates this terminal is the third one: each terminal runs its own tmux session. (I created a new one to make the font larger, so it's easier to see in this screenshot; this is the only difference between this terminal and my real ones.)

    The prompt also looks funny, right? With so much information jammed into the prompt, I like to stick in a newline so that if I want to do impromptu shell programming or write a five-step pipeline, I can do it without having things spill over. The trade-off is that simple sequences of commands—touch this, copy that, move this—scroll off my screen faster.

    [...]

    The first bit in the prompt is the bit I like the most: one letter that lets me know the Git status of the directory. It is G if the directory is "(not in) Git," K if the directory is "OK" and nothing needs to be done, ! if there are files unknown to Git that must be added or ignored, C if I need to commit, U if there is no upstream, and P if an upstream exists, but I have not pushed. This scheme is not based on the current status but describes the next action I need to do. (To review Git terminology, give this article a read.)

    This terminal functionality is accomplished with an interesting Python utility. It runs python -m howsit (after I installed howsit in a dedicated virtual environment).

  • Compare the speed of grep with Python regexes

    As we were converting our Shell scripts to Python anyway I thought I could rewrite it in Python and go over the file once instead of 20 times and use the Regex engine of Python to extract the same information.

    The Python version should be faster as we all know file I/O is way more expensive than in-memory operations.

    After starting conversion it turned out to be incorrect. Our code became way slower. Let's see a simulation of it.

  • Compare the speed of Perl and Python regexes

    The regex engine in Perl is much faster than the regex engine of Python.

    The are both slower than grep as measured when I compares Python with grep.

  • SSH Emergency Access

    Why would you want this? Only as an option of last resort. A backdoor into your servers when, for whatever reason, nothing else works.

    Why use certificates instead of public/private keys for emergency access?

    Passive revocation. Certificates expire; public keys don't. You can mint an SSH certificate valid for 1 minute, or even 5 seconds. Once it expires, the certificate will become unusable for new connections. This is perfect for occasional emergency access.

    You'll be able to create a certificate for any account on your hosts and send short-lived certificates to colleagues as needed.

  • Cartesi Launches 'Descartes' SDK Portal - Future of DApps

    Cartesi, the most recent Binance Launchpad IEO announced the launch of their Descartes SDK Documentation portal. The SDK Portal represents a leap forward for the Cartesi team in fulfilling their ambition in bridging the world of Linux open-sourced software, with the inherent security benefits of blockchain technology.

  • Cartesi launches Decartes SDK bringing blockchain dapp development to Linux

    The Cartesi Foundation today announced the launch of the Decartes software development kit and developer portal to enable developers to build distributed ledger blockchain apps using the Linux operating system.

    The SDK, which is currently an alpha test version, will allow developers to use mainstream software and libraries to develop distributed apps, or dapps, more easily while also keeping the security and capabilities of the blockchain.

  • Cartesi Launches SDK and Developer Portal Making DApp Development Feasible with Linux

    Cartesi, an innovator in the blockchain space, today announces the publishing of the alpha version of its Descartes Software Development Kit (SDK) and developer portal in line with its roadmap.

    Erick Demoura, CEO & Co-Founder of Cartesi said, "With this SDK release, we prove our continued commitment to making DApps powerful and easy to build. The SDK launch will allow developers who are already in the blockchain space to perform heavy computations and to get the convenience and the tools they were lacking before. Our vision is to make it possible, in the future, for any developer to build on top of Cartesi, to remove the boundaries and to make broad adoption of DApps a reality."

  • Isolating PHP Web Sites

    If you have multiple PHP web sites on a server in a default configuration they will all be able to read each other’s files in a default configuration. If you have multiple PHP web sites that have stored data or passwords for databases in configuration files then there are significant problems if they aren’t all trusted. Even if the sites are all trusted (IE the same person configures them all) if there is a security problem in one site it’s ideal to prevent that being used to immediately attack all sites.

    [...]

    The Apache PHP module depends on mpm_prefork so it also has the issues of not working with HTTP/2 and of causing the web server to be slow. The solution is php-fpm, a separate server for running PHP code that uses the fastcgi protocol to talk to Apache. Here’s a link to the upstream documentation for php-fpm [4]. In Debian this is in the php7.3-fpm package.

  • Template Haskell recompilation

    I was wondering: What happens if I have a Haskell module with Template Haskell that embeds some information from the environment (time, environment variables). Will such a module be reliable recompiled? And what if it gets recompiled, but the source code produced by Template Haskell is actually unchaned (e.g., because the environment variable has not changed), will all depending modules be recompiled (which would be bad)?

  • Breathing life into the (Emacs) cperl-mode

    If you are an Emacs user, you might know or even use cperl-mode. I am using it, more or less since my first days with Perl. Back then, newsgroups were a thing, and Ilya Zakharevich recommended it occasionally. In older times cperl-mode was shipped with Perl, today it is part of Emacs.

  • From the user perspective, Perl strings have no bugs and work well.

    I feel that in the upcoming version of Perl, the core team fixes the Unicode bug as a reason to break backward compatibility Perl 5.

    Unicode in Perl internally has some inconsistencies due to conflicts between latin-1 and UTF-8.

    this is true.

    On the other hand, from the user's point of view, a Perl string works perfectly fine if you only accept it can't tell whether it's a decoded string or a bytes.

    We are solving this problem by convention.

  • Monthly Report - June

    COVID-19 seems to be still haunting us but life is getting back to normal slowly. I had the pleasure to attend the first "Conference in the Cloud". It was 3 days event. I booked 3 days off from the work so that I can focus on the event without any interruptions. It was my first experience attending event in the cloud. I found it hard to focus on the talk in general.

    Could it be as I was at home with kids running around?

    The day one itself started on a very happy note with the announcement of "Perl 7" by Sawyer X. The entire day one was dedicated to this very topic. brian d foy even had his first book "Preparing for Perl 7" launched with the announcement. Thanks to the author brian d foy, I had the pleasure to read the first copy of the book. I simply loved it. The best introductory book on Perl 7 so far. Please go and check out yourself.

    I have been attending Perl conference for many years now but never had the opportunity to meet Damian Conway. The "Conference in the Cloud" made it possible to watch him live for the first time. As expected, I loved his talk, although it was recorded.

  • More stupid Bash tricks: Variables, find, file descriptors, and remote operations

    This blog post is the second of two covering some practical tips and tricks to get the most out of the Bash shell. In part one, I covered history, last argument, working with files and directories, reading files, and Bash functions. In this segment, I cover shell variables, find, file descriptors, and remote operations.

  • Python Software Foundation: Announcing the PSF Project Funding Working Group

    For the past 3 years, the PSF has been working on grant funded projects to improve our internal systems and platforms. This work has been done with the Packaging Working Group, and focused on our packaging ecosystem of PyPI and pip. We have been able to show that applying directed funding to open source projects has the ability to dramatically increase the speed of development, and move our community forward in a much more sustained way than relying solely on volunteer effort.

    [...]

    The PSF has created the Project Funding Working Group to help our community seek similar funding for their own projects. We hope to expand the amount of money going into the Python community as a whole, by providing resources and advice to projects who are interested in seeking funding from external sources.

    Our charter starts with our intended purpose:

    This Working Group researches, and advises Python community volunteers on applying for external grants and similar funding to advance the mission of the PSF, which includes, but is not limited to, things such as advancing the Python core, Python-related infrastructure, key Python projects, and Python education and awareness.
    You can read the entire charter for more information about the vision for the group that we intend to build over the medium and long term.

More in Tux Machines

Graphics: AMD, Intel and Wayland/Wayfire

  • Defaulting Radeon GCN 1.0/1.1 GPUs To Better Linux Driver Is Held Up By Analog Outputs

    Switching from the "Radeon" to "AMDGPU" kernel driver on Linux is possible for Radeon GCN 1.0/1.1 era graphics cards and doing so can mean slight performance benefits, the ability to run the AMDVLK or RADV Vulkan drivers, and simply making use of this better maintained driver. But having these original GCN graphics cards default to the modern AMDGPU driver appears held up by the lack of analog video output support with that driver.

  • Intel's Open-Source H.265/HEVC Encoder Sees First Release Of 2020

    Intel's Scalable Video Technology team is known for their open-source video encoder work particularly on AV1 and VP9 formats, but they also continue to maintain a high performance H.265/HEVC encoder as well. Intel SVT-HEVC 1.5 was released on Monday as their first major update of the year. Intel SVT-HEVC 1.5 fixes "all memory leaks" following a refactoring of their allocation/deallocation code that also leads to the ability for FFmpeg to run multi-instance encoding in parallel. SVT-HEVC 1.5 also has a number of optimizations, fixes for a random hang issue with few threads (something we've seen as well with SVT-HEVC in our own benchmarks), and a number of other fixes.

  • GNOME's Mutter Adds Support For Launching "Trusted Clients" On Wayland

    Merged to GNOME's Mutter compositor is an API for Wayland to allow the launching of trusted clients. This "trusted clients" support is namely about allowing child windows to be signified as being from a parent window/process. This can also allow for some nifty use-cases for GNOME on Wayland. The patch explains: Unfortunately, although the child process can be a graphical program, currently it is not possible for the inner code to identify the windows created by the child in a secure manner (this is: being able to ensure that a malicious program won't be able to trick the inner code into thinking it is a child process launched by it).

  • Wayfire 0.5 Wayland Compositor Brings Latency Optimizations, More Protocols

    Wayfire, a Wayland compositor inspired by the likes of Compiz with different desktop effects, is out today with a new feature release. Perhaps most exciting with Wayfire 0.5 is the work done to improve (reduce) the latency. Wayfire now better tracks how much time it needs to draw a frame, support for the presentation time protocol, and other work. Aside from latency improvements, there are Wayland protocol additions for primary selection for allowing middle-click-paste to work plus the output-power-management protocol for better handling display output power management behavior.

How Librem 5 Solves NSA’s Warning About Cellphone Location Data

The NSA has published new warnings for military and intelligence personnel about the threats from location data that is captured constantly on modern cellphones (originally reported by the Wall Street Journal). While privacy advocates (including us at Purism) have long warned about these risks, having the NSA publish an official document on the subject helps demonstrate that cellphone tracking is a real privacy and security problem for everyone. We have been thinking about the danger of location data on cellphones for a long time at Purism and have designed the Librem 5 from scratch specifically to address this risk. The NSA document describes and confirms a number of the threats I wrote about almost a year and a half ago when I introduced our “lockdown mode” feature on the Librem 5–a feature that disables all sensors on the Librem 5. In this post I’ll describe the threats the NSA presents in their document and how we address them with the Librem 5. Read more Also: Librem 5 Web Apps

Latest Linux Magazine (With Paywall)

Android Leftovers