Increasing swap space for Raspberry Pi

Open a terminal and type the command: sudo nano /etc/dphys-swapfile Inside this file, change the value after “CONF_SWAPSIZE” to 2048. Save it then commit your changes with the following command: sudo dphys-swapfile setup NOTE: this will create a 2 gigabyte swap file on your SD card; make sure it’s large […]

Add Redmine domain in Plesk

Install ‘Tools required for building Ruby Gems’ using Plesk installer Download the latest version of “Redmine” from its official website . Browse to Domains > > File Manager and Upload .zip file from step 1. Extract it and copy all the extracted content to httpdocs . Rename config/database.yml.example to config/database.yml Browse to Domains > > Databases and create a database. Browse […]

Recursive files renaming adding a suffix

To rename all files in a directory recursively adding a suffix, for example in a way that the new filename suffix will be the number of lines of the original file (e.g. if the file ‘my_file’ has 10 lines then it will be renamed to ‘my_file_10’): To keep extensions (if present):

Add indicator on Ubuntu topbar

Per aggiungere un indicator alla topbar di Ubuntu è sufficiente, aprire una console e lanciare il comando: sudo apt-get install indicator-<indicator name> Per esempio, se si vuole installare l’indicator per gestire input e output audio  basta lanciare il comando: sudo apt-get install indicator-sound*

Recursively files renaming on Linux cli

To change files name recursively you can combine the commands find and rename, as in these ways: To add suffix (e.g. ‘_mysuffix’) find . -name “*.jpg” -exec rename -v ‘s/\.jpg$/\_mysuffix.jpg/i’ {} \; To remove suffix find . -name “*.jpg” -exec rename -v ‘s/\_mysuffix.jpg$/\.jpg/i’ {} \; To add prefix (e.g. ‘myprefix_’) find […]

Change an html element’s class with JavaScript and jQuery

Changing Classes with JavaScript To dynamically change class(es) of an html element using Javascript, you can use classList method: document.getElementById(“MyElement”).classList.add(‘MyClass’); document.getElementById(“MyElement”).classList.remove(‘MyClass’); if ( document.getElementById(“MyElement”).classList.contains(‘MyClass’) ) { … } document.getElementById(“MyElement”).classList.toggle(‘MyClass’); To change all classes for an element: document.getElementById(“MyElement”).className = “MyClass”; document.getElementById(“MyElement”).className = “MyClass1 MyClass2”; The above commands will overwrite the existing classes; […]

Allow setup of user access on Windows 10 domain-joined devices

Windows terminals accessible via a domain account sometimes don’t allow access via Windows Hello (i.e. via PIN or facial recognition). The way to resolve this problem is quite simple and quick. It’s enough to set a key value of a system registry. From “Start” run the command: regedit Now inside […]

Convert ampersands before serialize()

As jQuery official documentation reports, the .serialize() method creates a text string in standard URL-encoded notation. It can act on a jQuery object that has selected individual form controls. The .serialize() method creates a text string in standard URL-encoded notation. It can act on a jQuery object that has selected […]