Welcome to LinuxScrew

A site for Linux lovers worldwide. For newbies, system engineers, administrators, and everybody in between. We cover all things Linux, plus various programming languages, including Python, Javascript, and PHP.

View our featured tutorials and projects in the slider below or scroll down to see all recent articles.

How to Convert a USB Printer to Wireless with a Raspberry Pi
How to Use a Raspberry Pi for Digital Signage
The Worst Things You’ll Probably Google As a Programmer on Linux
How to Build a Raspberry Pi Internet Kiosk
Browsing the Internet on a 1989 Macintosh II with a Web Rendering Proxy
previous arrow
next arrow
Slider

Check/Validate String Matches Regex in JavaScript [Examples]

JavaScript regex match

This article will show you how to use Regular Expressions (Regex) to validate matching strings in JavaScript. All user input collected in your applications should be validated. If an email address is required, a valid email address should be entered, or sending the email will fail. If a phone number is required, a valid phone number must be entered, and so on. Regex can be used for this validation by matching a whole string to a specified format. Regex can also be used to search … Read more

Simple Guide to Python Multiprocessing/Threading [Examples]

Python multiprocessing

This article will provide a simple introduction to multiprocessing in Python and provide code examples. The code and examples in this article are for Python 3. Python 2 is no longer supported, if you are still using it you should be migrating your projects to the latest version of Python to ensure security and compatibility. What is Multiprocessing? Usually, Python runs your code, line-by-line, in a single process until it has completed. Multiprocessing allows you to run multiple sets of instructions simultaneously in separate processes, enabling your … Read more

Running External Programs in Python with subprocess [Examples]

Python subprocess

This article will show you how to use the Python subprocess module to run external programs and scripts from Python. It is often necessary to call external applications from Python. Usually these are command-line applications which you can use to perform tasks outside of the Python environment, like manipulating files, or interacting with third party services. For example, you might call the wget command to retrieve a remote file. Any application which is accessible on the command line is available to subprocess, and can be executed from within Python. You … Read more

for…in Loops in JavaScript – How to Use Them

JavaScript for...in loop

The for…in loop in JavaScript loops over all of the properties in an object. This article will explain why and how to use it. JavaScript Objects JavaScript objects are a kind of variable which store the properties for an item you are representing in your code. For example, you may have a car object, which of which the make, year, model, and colour of a car are it’s properties. Each car object would have it’s own separate list of properties which define that car. JavaScript objects can also be used as hash tables – providing … Read more

Remove Page Elements using JavaScript RemoveChild [Examples]

JavaScript removeChild()

The Node.removeChild() method removes HTML Element from the current page via the DOM. This article will show you how to use it. The DOM in JavaScript The HTML DOM (Document Object Model) is the interface which JavaScript uses to interact with HTML page elements, including adding, removing, and modifying on-screen items. It is the data structure which represents every HTML tag present on a page – everything from the root <html> element that wraps the page to every <div>, <p>, <input>, and <span> – everything on the page is represented in the DOM, both … Read more

Use appendChild() in JavaScript to Add Page Elements [Examples]

JavaScript appendChild()

The Node.appendChild() method adds a new HTML Element to the page (via the DOM). This article will show you how to use it. The DOM in JavaScript The HTML DOM (Document Object Model) is the interface which JavaScript uses to read from and interact with HTML page elements. It’s a data structure which represents every HTML tag present on the page – everything from the root <html> element that wraps your page to every <div>, <p>, <input>, and <em> – everything on the page is represented in the DOM, both content and structure. Each … Read more

Generate a Hash from String in Javascript, with Examples

JavaScript Hash String

This tutorial will show you a practical way to generate a hash for a string in JavaScript, and provide working code examples you can use in your own project. What is a Hash? A Hash or Checksum is a calculated value with a specific length. By passing a hashing algorithm a string – which can be any length – a calculated hash of a consistent length is returned. Whenever the same string is passed to the hashing algorithm, the same calculated hash should be returned. … Read more

Pop!_OS on the Raspberry Pi [Review]

Pop!_OS Raspberry Pi Review

Pop!_OS has made it to the Raspberry Pi.  This Linux distribution has become quite popular over the last few years – so how does it perform on the tiny single board computer? Read on to find out. Pop!_OS is a relatively new distribution which aims to provide an out-of-the-box Linux experience appropriate for STEM, creativity, gaming, and general use.  It largely succeeds at all of these (and I’ve used it for various projects), so I am interested to see how it performs on a Raspberry … Read more

JavaScript setAttribute() Method-What It Is/How to Use It [Examples]

JavaScript setAttribute()

JavaScript was built for adding interactivity to web pages. It can interact with and modify on-screen elements, including their HTML attributes – thats what setAttribute() does. Here’s how to use it. What is the HTML DOM? The HTML DOM (Document Object Model) is the interface which JavaScript uses to read from and interact with HTML page elements. It’s a data structure which represents every HTML tag present on the page – everything from the root <html> element that wraps your page to every <div>, <p>, <input>, and <em> – everything on the page is … Read more

Linux Tip: Travel Securely with an Encrypted Linux USB Stick

Linux travel USB install

Travel is back. Do you have a plan for what happens if your laptop, with your passwords and banking details and secret projects gets stolen? Read on for a nifty way to mitigate the inconvenience of a lost laptop. Taking Your Laptop on Holiday I often take my laptop on holiday. I really shouldn’t, but sometimes you want to take a break from trekking through cobblestone streets or sitting by the pool. For me, this usually means tinkering away on some kind of code project, … Read more