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

digiKam 7.7.0 is released

After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release. Read more

Dilution and Misuse of the "Linux" Brand

Samsung, Red Hat to Work on Linux Drivers for Future Tech

The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world. Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.