5 Reasons to put DietPi on your Raspberry Pi

If you’re looking for an operating system to replace Raspberry Pi OS on your Raspberry Pi or other SBC, an option worth your time is DietPi. Here are just a few of the reasons why.

In case you haven’t heard of it, DietPi is a free and open source operating system based on Debian Linux. It’s designed to be run on SBCs (Single-Board Computers) like the Raspberry Pi where resources are usually limited and useage is specialized. The conventional choice is Raspberry Pi OS (formerly known as Raspian), but DietPi is an alternative with several tweaks and custom tools.

[mai mult...]

How to use our Steam Deck as a Linux PC

Your Steam Deck can do more than just play games. Valve effectively crammed a laptop into a handheld form factor, threw Linux on it, and left the system wide open for anyone to fiddle with.

The upshot of this approach is that you can use your Steam Deck like a regular PC, to browse the web, install third-party tweaks and tools, and even get some work done (if you’re not too busy playing games).

[mai mult...]

How to install and get started with Docker Desktop on Linux

The steps in this article have been tested in a clean Ubuntu 22.04 environment. Desktop’s also supported on Ubuntu 21.10, Debian 11, and Fedora 35/36. Distro-specific documentation is available on Docker’s website.

Desktop requires a 64-bit system with 4 GB of RAM and KVM hardware virtualization enabled. The KVM kernel module is usually enabled automatically when your host supports virtualization. You can check by running the kvm-ok command:

$ kvm-ok

INFO: /dev/kvm exists

KVM acceleration can be used

Enable virtualization in your system’s BIOS or UEFI if kvm-ok reports an error. You can also try manually loading the KVM kernel module using modprobe:

# 1/2

$ sudo modprobe kvm

# 2/2 INTEL ONLY

$ sudo modprobe kvm_intel

# 2/2 AMD ONLY

$ sudo modprobe kvm_amd

Docker Desktop isn’t designed to run alongside Docker Engine. You should stop the Docker service if you’ve already been using Docker Engine on your machine. This will reduce resource consumption and minimize the risk of conflicts between Engine and Desktop.

$ sudo service docker stop

Installing Docker Desktop

The Docker Desktop package isn’t yet available in repositories so it must be manually acquired. Download the right package for your operating system using the links in the documentation.

$ wget https://desktop.docker.com/linux/main/amd64/docker-desktop-4.12.0-amd64.deb

The Docker Desktop package depends on other packages from the Docker repository. Although Desktop itself isn’t installed from the repository, you still need it in your sources list so the dependencies can be resolved. Run the following sequence of commands to add Docker’s Apt repository to your machine:

$ sudo apt update

$ sudo apt-get install -y \

ca-certificates \

curl \

gnupg \

lsb-release

# Download the GPG key used to sign the packages in the repository

$ sudo mkdir -p /etc/apt/keyrings

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg –dearmor -o /etc/apt/keyrings/docker.gpg

# Add the repository to your package sources list

$ echo \

“deb [arch=$(dpkg –print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \

$(lsb_release -cs) stable” | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

$ sudo apt update

Now you can install the Desktop package with Apt’s install command:

$ sudo apt install -y ./docker-desktop-4.12.0-amd64.deb

Docker Desktop should now appear in your applications list.

Using Docker Desktop

Start Docker Desktop from your operating system’s app launcher. You should see the Docker whale icon appear in your system tray. Clicking the icon displays Docker’s tray menu.

The first run initialization process could take a couple of minutes to complete. The icon’s animation will stop and the status line at the top of the menu will change to “Docker Desktop is running” when Docker’s ready to use. Click the “Dashboard” item at the top of the menu to open the UI if it doesn’t appear automatically.

You’ll be prompted to accept the terms of service and will then be taken to the Containers screen. You can optionally login to Docker Hub by clicking the Login button in the title bar and following the prompts.

Try running docker and docker compose in your terminal to check the CLIs are available:

$ docker version

Client: Docker Engine – Community

Cloud integration: v1.0.29

Version: 20.10.18

$ docker compose version

Docker Compose version v2.10.2

Next start a container to verify your installation’s working:

$ docker run -d -p 80:80 docker/getting-started

Your new container should show up in the Docker Desktop UI. Clicking the three dots icon to the right of the table reveals a list of actions you can take within Docker Desktop, such as opening a terminal inside the container or visiting published ports in your browser.

The Images tab on the left side of the screen provides a table of all the container images present on your host. Controls are available to clean up unused images, quickly start a new container from an image, and push and pull images between different registries.

You can get more information on using Docker Desktop within the documentation. The functionality covers many of the docker CLI commands while layering in additional higher-level concepts such as Developer Environments for work-in-progress code sharing.

Enabling Kubernetes

Docker Desktop has integrated Kubernetes support but it’s not enabled by default. Turn it on by clicking the settings cog icon in the app’s title bar and then selecting “Kubernetes” from the menu on the left.

Check the “Enable Kubernetes” checkbox and press the “Apply & Restart” button in the bottom-right. It could take several minutes for Docker to acquire the Kubernetes components and create your cluster. A Kubernetes status icon will appear in the bottom-left of the app, next to the Docker icon. It will turn green when Kubernetes is ready to use. The Kubernetes status is also shown at the top of Docker Desktop’s tray menu.

Next install Kubectl. This is the CLI used to interact with your Kubernetes cluster. The official Snap package is the easiest way to add it to Ubuntu:

$ sudo snap install kubectl

Now try using Kubectl to access your cluster:

$ kubectl get nodes

NAME STATUS ROLES AGE VERSION

docker-desktop Ready control-plane 22m v1.25.0

The docker-desktop node shows as Ready so you can start creating Pods:

$ kubectl run nginx –image nginx:latest

pod/nginx created

Expose your Pod with a service:

$ kubectl expose pod/nginx –port 80 –type NodePort

service/nginx exposed

Now find the host port that was allocated to the service:

$ kubectl get services

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 23m

nginx NodePort 10.96.132.212 <none> 80:30107/TCP 75s

The port number is 30107. Use this port to access your service and retrieve the default NGINX landing page:

$ curl http://localhost:30107

<!DOCTYPE html>

<html>

<head>

<title>Welcome to nginx!</title>

Your Kubernetes cluster is fully operational. It’ll start automatically whenever Docker Desktop is running.

Docker Desktop vs Docker Engine

Docker Engine is completely separate to Docker Desktop. Docker Engine launches containers as processes directly on your host. It uses a system service to run the Docker daemon. The docker CLI targets this daemon instance when you issue commands.

Docker Desktop runs your containers inside a QEMU virtual machine. You don’t have to directly interact with QEMU as the VM’s creation and management is handled for you. Launching Docker Desktop automatically starts the VM; quitting the app will shut it down.

The VM architecture was a necessity for running Docker on Windows and Mac systems. It provides a predictable environment for hosting Linux containers. The Docker team decided to continue using VMs for Desktop on Linux to prevent inconsistencies arising between platforms.

Although the VM doesn’t affect day-to-day Docker usage, it’s a heavier solution that demands more resources than Docker Engine. You can expect the VM to consume around 2 GB of RAM while idle, even when no containers are running. Docker Engine’s memory consumption would be negligible in the same situation.

This means Docker Engine remains the best way to run containers on Linux in production environments or wherever performance is critical. Desktop is a great option for developers who want to use the same fully integrated workflow as peers on Windows and Mac. Desktop’s also the best choice when you want to use Kubernetes without adding any extra tools. You’ll need a dedicated Kubernetes environment such as Minikube or MicroK8s if you’re using Docker Engine.

You can customize the Docker daemon configuration used by Desktop by clicking the settings cog icon in the title bar and heading to the “Docker Engine” tab on the left of the screen.

Type or paste your changes into the input provided, then press “Apply & Restart” in the bottom-right corner. Docker Desktop automatically limits the resources that its virtual machine can consume. The defaults are half of the total number of processor cores available, 25% of your system memory, and a 1 GB swap file.

These limits can be changed by heading to Docker Desktop’s settings screen and clicking the “Resources” tab in the menu on the left. Use the sliders to customize the cap for each resource. You can resize the virtual disc used to store the VM’s data by scrolling down the screen. Click the “Apply & Restart” button in the bottom-right when you’re done.

[mai mult...]

How to build a simple Portfolio website using Wix

It is a free cloud-based website builder, which means that you do not need to download and install Wix. You can just create your website on the go without writing code. You also don’t have to worry about hosting your website (the act of making your site available to visit on the web). When you build your website on Wix, your website is automatically hosted on Wix’s hosting platform.

Apart from building portfolio websites, Wix is also used to build other kinds of websites like blogs, online stores, and more. Not sure you have what it takes to build a website? To create websites with Wix, all you need is a stable internet connection, a computer device, and the information and pictures you want to include on the website.

Below are the benefits of using Wix;

  • Easy to use: It has a user-friendly drag-and-drop interface.
  • Customization: It also has attractive and “responsive” templates so you can view your website on a computer device, tablet, or phone, and the design still remains intact. If you would like a customized website tailored to your specific needs, Wix has an Artificial Design Intelligence (ADI) that can build your website for you when you answer some questions concerning the website that you want to build.
  • Reliability: Wix has a reliable hosting platform.
  • Support: In case you get into a fix on their website, Wix has tutorials to help resolve issues.

Create an Account on Wix

To create an account, visit Wix’s official website and click on “Get Started”. You can create an account by signing up through Facebook, Google or by signing up directly using your email. Wix will send an email for confirmation. Confirm your email and get started on Wix.

If you already have an account, you can sign in to your account.

Setup your Website

When you log in as a first-time user, Wix will direct you to its homepage, where you will indicate who you are creating the website for.

If you already have an account on Wix, once you sign in, Wix will direct you to the “My Sites” page. On the page, Click on “Create New Site”. After this, Wix will direct you to a page that will ask you to choose whether you want Artificial Intelligence (AI) to assist you in building the website.

If you want to set up your website with AI, it will provide personalized content based on your prompts. You can do this by clicking “Start Chat” on Wix.

For this guide, we will not be using AI, so click “Setup Without AI”. Wix will redirect you to a page that asks what kind of website you want to build.

  • On this page, click on “Portfolio”. You can choose to specify the kind of portfolio website that you want or click on “Continue”
  • If you are a first-time user, Wix will prepare a dashboard for you
  • Enter your website’s name and click on “Continue”.
  • Choose what you want to include on the website, it can be a blog, video, Instagram feed, etc. If you don’tt want any of the options on your website, click “Continue”.
  • Head to your dashboard to set up your website by clicking “Continue to Dashboard”.
  • From your dashboard, select “Design Site”.
  • Then select “Pick a Template” because you will be designing from one of the templates.
  1. The next page will display all the portfolio templates that you can choose from and customize. Scroll through the pages and find the template that you like or fits your profession.
  2. To view the full demo of each of these templates, hover over them, click on “View” and then click on “View Full Demo”. The full demo view lets you see other pages other than the homepage that Wix displays.
  3. When you see your desired portfolio style, hover over that template and click on “Edit”, Wix will direct you to its editor. It may take a while to load.

Customize your Chosen Style

After choosing the style that you like, it is time to personalize it. You can customize the template with your own information, pictures, or any other edits to make this design up to your taste. I chose the “Artist” portfolio template.

To write your name, double-tap on the text box and type your name. You can also change the font size and style.

To edit the “About” section, click on the paragraph and write information about you, what you do, and what your interests are. When people view this section of your website, they should know a little bit about you.

Another important section to look out for is the “Contact” section. If your potential employers come across your website and want to reach out to you, they will be looking for this section. Click the edit button and input your contact information. This includes your email address, business phone number, and physical location. Do not add information that is too personal to you or sensitive because this website is accessible to anyone.

Take your time to play around with the features and functionalities. When you are done editing your template, you can preview your website in desktop and mobile mode to ensure that it is responsive. To preview your website, click the phone or desktop icon at the top-right corner of the screen.

  • When you have completed your website edits, click on “Publish.”.
  • A dialogue box will appear requesting that you choose a domain before you publish. A domain is like the street address of your website’s virtual home.Click on “Get a Free Wix.com Domain” and insert the name of your website after the backslash.
  • If there is no other domain exactly like that, you can proceed to click on “Save & Continue” but if Wix identifies that the domain name already exists, you have to edit yours.

Wix will save your site with that domain but it will not be live yet. To publish, in the next dialogue box that appears, click on “Publish Now” or “Done”.

[mai mult...]

Google Docs can now import and export Markdown

Google has announced that you can now convert content in Google Docs to and from Markdown. If you can’t do this yet, don’t fret—this feature will roll out from July 16 to all Rapid Release and Scheduled Release users, before ultimately landing in all Workspace and personal Google accounts.

Markdown was created in 2004 as a more user-friendly web page text formatting syntax than HyperText Markup Language (HTML). It uses hashtags, asterisks, and underscores (instead of hard-to-read code inside angle brackets) to add heading styles, bullet points, italics, and bold to text. This creation means that anyone can try their hand at technical content writing, as Markdown knocks down many (but not all!) of the complication barriers caused by HTML.

Now, to supplement its 2022 introduction of expanded support for creating content with Markdown on Docs, Google is offering users the ability to convert Docs content to and from Markdown.

This update includes the ability to:

  1. Export a Google Doc as Markdown syntax (through File > Download)
  2. Import Markdown syntax as a Google Doc (through File > Open or by clicking “Open with Google Docs” from Google Drive)
  3. Convert Markdown syntax to Google Docs content as an option when pasting the text
  4. Convert Google Docs content to Markdown syntax when copying the text

You don’t need to make any changes to start making the most of this upgrade. The import and export options (points 1 and 2 above) are enabled by default, though using the copy and pasting options (points 3 and 4 above) requires users to activate this option by clicking “Tools,” selecting “Preferences,” and checking “Enable Markdown”.

This much-demanded addition to Google Docs will come as a blessing to tech writers and engineers, new and old, as it facilitates better integration with other Markdown tools. More specifically, because Google Docs is well-known for easy and instant collaboration, this will encourage developers to use the program to work together before exporting their content as Markdown, smoothing the entire writing process significantly.

A logical next step would be for Google to enable users to view and edit Markdown files directly in Google Drive. Only time will tell if this comes to fruition.

[mai mult...]

Tasks you can automate using Regex

Regex (short for REGular EXpressions) makes it easy to clean up and standardize. While it’s versatile as an editing tool, it’s it has its limits in application. The best way to think about regex is as a super-powerful wildcard search or search-and-replace that you can use whenever you need it—where it’s supported, of course. Microsoft Excel recently started supporting regex, making it a useful skill to learn.

We’ve all been there: copying across some stuff from a PDF and then pasting it to your own document, only to have weird spacing and artifacts come across with the copy. But did you know that regex could help with that? Enter this command into your find-and-replace function:

Find: [^\S\r\n]{2,}|\s*\r?\n\s*\r?\n\s*
Replace: \n

This regex will make your text editor:

  • Remove any instance of multiple spaces
  • Reduces multiple line breaks to a single line break
  • Gets rid of trailing spaces

This should clean up whatever copied text you have into something that’s useful.

Bulk-Renaming Downloaded Files

In more than one unfortunate incident, I downloaded a set of files, and they came with odd names appended. If you have a bulk-rename tool like Advanced Renamer, you can use a regex to clean up those filenames into something more recognizable. If you have a series of files with symbols all over the place, you can use your renamer with this regex:

Find: [^a-zA-Z0-9-.]
Replace:

This keeps numbers, periods, and letters as they are but replaces everything else with dashes.

Currency Formatting

Let’s say you have a file with a ton of currency in different formats. You don’t want to manually go through each of those currencies and fix it to the format you want, especially if they’re in multiple weird formats. Here’s what you’ll use for your regex:

Find: \$?\s*(\d+(?:\,\d{3})*(?:\.\d{2})?)\s*(?:USD|dollars?)?
Replace: $\1

This regex will scrub through your currency file and clean up anything to give you a dollar sign, a currency entry, and two decimal places for cents.

Standardize Date Formats

I’ve been in several situations where I’ve had to extract dates into a standardized format, like moving them from text into a database. When you’re faced with something like this, you can use a regex to find and extract data into a simplified format (in this case, it should be in YYYY-MM-DD). The regex for this would be:

Find: \b(?:\d{1,2}[-/\.]\d{1,2}[-/\.]\d{2,4})|(?:(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-z]*[\s.-]?\d{1,2}(?:st|nd|rd|th)?[\s,.-]?\d{2,4})\b

This should search the entire document and fix all the dates to this standardized format.

Strip HTML Tags

When you copy something from the web, it sometimes has HTML tags attached to it. Luckily, regex has a handy method for stripping HTML tags from a document:

Find: <[^>]+>|&[^;]+;|\s*\n\s*
Replace: \n

This regex will sift through the document, find the HTML tags, and wipe them, along with extra line breaks and other HTML entities (like ‘&’). Now, you can easily clean up a document like this by simply looking for the tags and replacing them with something empty with this regex:

Find: <[^>]+>
Replace: (empty)

However, if your document uses weird HTML tags, formatting, or entities, you might encounter problems. The first regex is a general cleaning, and the second one is more in-depth in its searching.

Extract URLs from Text

Sometimes, you have a document with URLs buried inside the text. Pulling out those URLs shouldn’t require a manual search through the entire document, and regex will save you time. We already know that URLs always start with http or https, and we can use that knowledge in our regex:

Find: (https?:\/\/)?([\w\-]+(\.[\w\-]+)+\.?(:\d+)?(\/\S*)?)|((www\.)?[\w\-]+(\.[\w\-]+)+\.?(:\d+)?(\/\S*)?)

While this extractor will find your URLs, it has a few issues. If you have malformed URLs, or anything without http or https prefixes, you won’t see the URL. You won’t get emails with this pattern either, but there’s another one that you can use specifically for emails.

One of the most common problems I encounter when doing data scraping or email list validation is getting emails from a text file. Emails typically have a pattern that makes it easy for regex to interact with the text file. For an email search function, we’ll do something like this:

Find: (?:[a-z0-9!#$%&’*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&’*+/=?^_`{|}~-]+)*|”(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*”)@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

This might look like a lot, but it basically searches for anything that has the pattern <something>@<domain>.com. As robust as the regex is, it’s not perfect. It will miss any emails that start with a dot, and anything that isn’t properly formatted as an email will also be ignored.

Format Social Media Handles

When moving data from a form to or from a database, you sometimes have to fix some formatting problems. An excellent case in point is social media handles. The regex for doing this is:

Find: (?:^|[^@\w])[@\s]*(\w{1,30})
Replace: @$1

This is the most robust use case for formatting social media handles, but each platform has its own nuances for usernames. You can’t write error-checking for those specific handles unless you use this regex in a Python script, for example. Even so, debugging your Python code with regex might be a bit more complicated.

There’s a saying that if you have a hammer, every problem starts to look like a nail. As an experienced coder, I can say that’s 100% true regarding regex. There are several places online that can help you learn regex, but you should use this knowledge sparingly.

Including a regex in your code can complicate your debugging process. They don’t lend themselves to commenting either, making it more difficult to share code with others. Finally, they are part of an automation system; if the source data is bad, the results will also be bad. While regex is a powerful tool, it’s better for some things than for others.

[mai mult...]