Categories
Coding

Javascript detect keycodes tool

Type a key on your keyboard to find the key code / keyboard code

Javascript code is :

Categories
WordPress

Debian WordPress Permalink

404 Not found Error fix

Add the below code in /etc/apache2/apache2.conf

<Directory /var/www/html/>
AllowOverride All
</Directory>
sudo a2enmod rewrite
sudo systemctl restart apache2
Categories
Git

Git remove large file wrongly committed

git filter-branch --tree-filter 'rm -rf path/to/your/file' HEAD
git push
Categories
Networking

Create MikroTik image

Download the raw disk image archive from Mikrotik

wget https://download2.mikrotik.com/routeros/6.42rc30/chr-6.42rc30.img.zip

Unzip the archive

unzip chr-6.42rc30.img

Expand the image size to 1GB

truncate --size=1G chr-6.42rc30.img

Create the image archive for Google GCE

mv chr-6.42rc30.img disk.raw tar -Sczf chr-6.42rc30-image.tar.gz disk.raw

To upload in Google cloud

Create a bucket to store image archives

gsutil mb gs://cloud-hosted-router-images

Copy the new image to the bucket

gsutil cp chr-6.42rc30.tar.gz gs://cloud-hosted-router-images

Create a Google cloud image

Create an image for GCE from the archive

gcloud compute images create "routeros"
--family=cloud-hosted-router
--description "Mikrotik Cloud Hosted Router (CHR) for running as a virtual machine."
--source-uri "https://storage.googleapis.com/cloud-hosted-router-images/chr-6.42rc30.tar.gz"

Create MikroTik instance

Create an instance

gcloud compute instances create "chr-1"
--zone "us-central1-c"
--machine-type "f1-micro"
--image-family=cloud-hosted-router

For Mac

For truncate:

brew install truncate
truncate -s 1G chr-6.42rc30.img

For gnu-tar:

brew install gnu-tar
gtar -Sczf chr-6.42rc30.tar.gz disk.raw
Categories
Web Server

Integrating PHP in Apache

To enable PHP in Apache add the following to httpd.conf and restart Apache:

LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>

Finally, check DirectoryIndex includes index.php

DirectoryIndex index.php index.html

The php.ini and php-fpm.ini file can be found in:

/usr/local/etc/php/7.4/