Sunday, May 22, 2022

How to install Miniconda Environment in Linux

Download the latest Miniconda version from the official download page.

$ wget

Go to the location where you downloaded the Miniconda installer and check the integrity of the downloaded file with SHA-256:

$ sha256sum

You will see an output like below:

What is Miniconda Script?

Miniconda is a minimal and stripped-down version of Anaconda distribution. As the name implies, Miniconda contains only Conda package manager, Python and a small number of useful packages such as pip, zlib including their dependencies.

Miniconda is suitable for those who don't mind to install each package individually. It saves you not only the disk space but also avoids dumping a lots of unnecessary applications that you don't use often in your hard drive. For those wondering, Anaconda distribution automatically installs 1,500 packages that consumes around 3 GB disk space. If you use only a handful of applications, miniconda might be a good choice!

How to Install VLC dan Totem Player in Fedora 33 with Flatpak

The previous method is perfectly fine to install and enable most commonly required multimedia codecs in Silverblue. In addition, you can install VLC or Gnome Videos (Totem) or Celluloid (Formerly Gnome Mpv) to get all necessary codecs.

To install VLC on Fedora Silverblue, run:

$ flatpak install flathub org.videolan.VLC

To install Gnome Videos on Fedora Silverblue, run:

$ flatpak install flathub org.gnome.Totem

Another popular media player is Celluloid that has codecs to play all type of media files. To install Celluloid on Fedora, run:

$ flatpak install flathub io.github.celluloid_player.Celluloid

At this stage, you should have all necessary multimedia codecs installed on your Fedora Silverblue system.

How to Enable RPM Fusion repository on Fedora Silverblue

Many video codecs are non-free, so they are not included in Fedora default repositories and Flathub. So adding RPM Fusion repository is necessary. RPM Fusion repository provides the software which are not included in Fedora and Red Hat.

Saturday, May 21, 2022

What is ELevate Script?

 ELevate is an open source migration tool developed by AlmaLinux team. It allows you to easily and smoothly migrate between major versions of RHEL-based distributions from 7.x to 8.x version.

ELevate combines Red Hat's Leapp framework with a community created library and service for the migration metadata set required for it.

It currently supports migration from CentOS 7 to the following OSes:

  • AlmaLinux OS 8
  • CentOS Stream 8
  • Oracle Linux 8
  • Rocky Linux 8

Migrations can be done in place, meaning data and configuration files are preserved. In other words, all the installed applications and settings and data will remain intact. However, the users are HIGHLY ENCOURAGED to backup the important data before starting the migration.

ELevate is an open source program, released under the Apache 2.0 License.

How to Migrate from CentOS 8 to AlmaLinux


A word of caution:

As usual, backup important data from your CentOS system before starting AlmaLinux migration task. I tested this script in a freshly installed CentOS 8 virtual machine. My VM doesn't has any data and it is a server edition with minimal installation. It worked just fine without any issues as expected.

Step 1: Update your CentOS system to latest available version as root or sudo user:

$ sudo dnf update

Step 2: Reboot your system to apply the updates:

How to Install Golang in Linux

Install Golang In Linux Using Update-golang Script 

 Download the Update-golang script by cloning its repository from GitHub:
$ git clone
The above command will clone the contents of official update-golang repository in a local directory named update-golang. Cd into this directory:
$ cd update-golang
It is always recommended to check the integrity of a script downloaded from Internet. So let us do that by verifying the CHECKSUM value of update-golang script:
$ wget -qO hash.txt
$ sha256sum -c hash.txt
If you get an output as OK, you're good to go. OK
After verifying the chekcsum, run the following command to install latest Golang version on your Linux machine:
$ sudo ./
Sample output: version 0.24 find_latest: found last release: 1.16.2 user: uid=0(root) gid=0(root) groups=0(root) RELEASE_LIST= SOURCE= DESTINATION=/usr/local RELEASE=1.16.2 OS=linux ARCH_PROBE=uname -m ARCH=amd64 PROFILED=/etc/profile.d/ CACHE=/usr/local GOPATH= DEBUG= will install golang go1.16.2.linux-amd64 as: /usr/local/go is remote
--2021-03-30 06:02:35--
Resolving ( 2404:6800:4009:81f::2010, 2404:6800:4009:820::2010, 2404:6800:4009:81d::2010, ...
Connecting to (|2404:6800:4009:81f::2010|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 129010536 (123M) [application/octet-stream]
Saving to: ‘/usr/local/go1.16.2.linux-amd64.tar.gz’

/usr/local/go1.16.2.linux-amd64.t 100%[=============================================================>] 123.03M   501KB/s    in 5m 2s   

2021-03-30 06:07:40 (417 KB/s) - ‘/usr/local/go1.16.2.linux-amd64.tar.gz’ saved [129010536/129010536] remove_old_link: not found symlink for old install untar: tar -x -f /usr/local/go1.16.2.linux-amd64.tar.gz profile_path_add: issuing new /usr/local/go/bin to /etc/profile.d/ profile_path_add: issuing $HOME/go/bin to /etc/profile.d/ golang go1.16.2.linux-amd64 installed at: /usr/local/go testing: /usr/local/go/bin/go version unsudo: running_as_root:ostechnix: /usr/local/go/bin/go version go version go1.16.2 linux/amd64 /usr/local/go/bin/go version: SUCCESS unsudo: running_as_root:ostechnix: mktemp -t hello-tmpXXXXXXXX unsudo: running_as_root:ostechnix: tee /tmp/hello-tmpqGBVcjhy.go testing: /usr/local/go/bin/go run /tmp/hello-tmpqGBVcjhy.go unsudo: running_as_root:ostechnix: /usr/local/go/bin/go run /tmp/hello-tmpqGBVcjhy.go hello, world /usr/local/go/bin/go run /tmp/hello-tmpqGBVcjhy.go: SUCCESS running_as_root: yes recursively forcing build cache [/home/ostechnix/.cache/go-build] ownership to 1000:1000
Install Golang In Linux Using Update-golang Script
Install Golang In Linux Using Update-golang Script

Check Golang version and environment information 

 To verify the installed Go version, run:
 go version
go version go1.16.2 linux/amd64
As you can see, Update-golang script has installed Go version 1.16.2. This is the latest, stable Go version at the time of writing this guide. To print Go environment information, run:
$ go env
Sample output:

GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build883237217=/tmp/go-build -gno-record-gcc-switches"

Install Golang beta or release candidate (RC) version 

 By default, Update-golang script will install the latest stable version. If you want to install any beta or release candidate versions, explicitly mention the version like below: Install Golang beta:
$ sudo RELEASE=1.9beta1 ./
Install release candidate (RC):
$ sudo RELEASE=1.11rc1 ./
Golang per-user installation By default, Update-golang script installs Golang system-wide. If you want to install Golang for current user, simply create a installation directory, for example ~/golang:
$ mkdir ~/golang
And then install GO using command:
$ DESTINATION=~/golang PROFILED=~/.profile ./
Please note that per-user installation does not need root or sudo permission. Prevent caching downloaded files As mentioned earlier, Update-golang script will keep the downloaded archives in /usr/local directory. If you don't want cache the archive files, simply use -declutter option:
$ sudo ./ -declutter
This time the installation files will not be cached. 

 Remove Golang

 To undo all steps done by Update-golang script, go to the cloned directory and run:
$ sudo ./ remove
This command will remove Go and all related entries from the $PATH. version 0.24 find_latest: found last release: 1.16.2 remove: found symlink for old install: /usr/local/go1.16.2.linux-amd64 remove: removing symlink: /usr/local/go remove: removing dir: /usr/local/go1.16.2.linux-amd64 profile_path_remove: removing old settings from: /etc/profile.d/

Tuesday, May 17, 2022

Monday, May 16, 2022

How to Create Drag n Drop File Upload in CodeIgniter 4

 On this simple tutorial, we gonna make a file upload with drag n drop features. We will using CodeIgniter 4 framework and Dropzone.js library.


you're have running codeigniter 4 environment ready to used

Step 1. Enable CSRF in Codeigniter 4

Open .env file. Remove # from the start of the security.tokenName, security.headerName, security.cookieName, security.expires, and security.regenerate. Using security.tokenName read CSRF hash. You can update it with any other value.
# security.csrfProtection = 'cookie'
# security.tokenRandomize = false
security.tokenName = 'csrf_token_name'
security.headerName = 'X-CSRF-TOKEN'
security.cookieName = 'csrf_cookie_name'
security.expires = 7200
security.regenerate = true
# security.redirect = true
# security.samesite = 'Lax'
Open app/Config/Filters.php file. Uncomment in 'csrf' in 'before' if commented.
public $globals = [
    'before' => [
        // 'honeypot',
        // 'invalidchars',
     'after' => [
        // 'honeypot',
        // 'secureheaders',
Step 2. Create new Route Open app/Config/Routes.php file. Define 2 routes – / – Display file upload view. page/fileUpload – It is used to upload a file.
$routes->get('/', 'PageController::index');
$routes->post('page/fileUpload', 'PageController::fileUpload');
Step 3. Create the Controller Create PageController Controller –
php spark make:controller PageController
Open app/Controllers/PageController.php file.
         'file' => 'uploaded[file]|max_size[file,2048]|ext_in[file,jpeg,jpg,png,pdf],'

      if ($validation->withRequest($this->request)->run() == FALSE){

          $data['success'] = 0;
          $data['error'] = $validation->getError('file');// Error response


          if($file = $this->request->getFile('file')) {
             if ($file->isValid() && ! $file->hasMoved()) {
                // Get file name and extension
                $name = $file->getName();
                $ext = $file->getClientExtension();

                // Get random file name
                $newName = $file->getRandomName();

                // Store file in public/uploads/ folder
                $file->move('../public/uploads', $newName);

                // Response
                $data['success'] = 1;
                $data['message'] = 'Uploaded Successfully!';

                // Response
                $data['success'] = 2;
                $data['message'] = 'File not uploaded.'; 
             // Response
             $data['success'] = 2;
             $data['message'] = 'File not uploaded.';
      return $this->response->setJSON($data);


4. Create the View Create index.php file in app/Views/. and then Include Dropzone and jQuery library. You can download Dropzone from here or you can use CDN –

Create a hidden element to store CSRF token name specified in .env file in the name attribute and store CSRF hash in the value attribute.

Complete code:

   Drag and Drop file upload with Dropzone in CodeIgniter 4





Laravel Tutorial: How to Fetch Website Favicons

 On this laravel tutorial, we gonna create a favicon fetcher. This is our simple and straightforward solution to fetch the favicon from a website. We will be using Favicon Fetcher, an opensource library from here.

Before you start, you'll need to make sure that you've got an application running at least PHP 8.0 and Laravel 8.

You can install the package via Composer:

composer require ashallendesign/favicon-fetcher

You can then publish the package's config file using the following command:

php artisan vendor:publish --provider="AshAllenDesign\FaviconFetcher\FaviconFetcherProvider"

The package should now be installed and ready to use. You should also have a new config/favicon-fetcher.php config file.

Favicon Fetch method

To fetch a favicon from a website, you can use the fetch method which will return an instance of AshAllenDesign\FaviconFetcher\Favicon:

use AshAllenDesign\FaviconFetcher\Facades\Favicon;
$favicon = Favicon::fetch('');

Storing Favicon

You can store a favicon using your default filesystem disk like so:

use AshAllenDesign\FaviconFetcher\Facades\Favicon;
$faviconPath = Favicon::fetch('')->store('favicons');
// $faviconPath is now equal to: "/favicons/abc-123.ico"

Caching Favicon

If you have a page displaying 100 websites and their favicons, we would need to find the favicon's URL on each page load. So you need a caching mechanism. You can use this library.

use AshAllenDesign\FaviconFetcher\Facades\Favicon;
$faviconPath = Favicon::fetch('')