Monday, January 22, 2024

How to Install and Use PHP Composer on CentOS 7

 sudo yum install php-cli php-zip wget unzip

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

HASH="$(wget -q -O - https://composer.github.io/installer.sig)"

php -r "if (hash_file('SHA384', 'composer-setup.php') === '$HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer


composer



Wednesday, November 22, 2023

The file GeoLite2-Country.mmdb does not exist or is not readable laravel

 Composer

From the command line run:

$ composer require torann/geoip

Laravel

Once installed you need to register the service provider with the application. Open up config/app.php and find the providers key.

'providers' => [

    \Torann\GeoIP\GeoIPServiceProvider::class,

]

This package also comes with an optional facade, which provides an easy way to call the the class. Open up config/app.php and find the aliases key.

'aliases' => [

    'GeoIP' => \Torann\GeoIP\Facades\GeoIP::class,

];

Publish the configurations

Run this on the command line from the root of your project:

php artisan vendor:publish --provider="Torann\GeoIP\GeoIPServiceProvider" --tag=config

A configuration file will be publish to config/geoip.php.

Configuration

Quick breakdown of the two main options in the configuration file. To find out more simple open the config/geoip.php file.

Service Configuration

To simplify and keep things clean, all third party composer packages, that are needed for a service, are installed separately.

For further configuration options checkout the services page.

Caching Configuration

GeoIP uses Laravel's default caching to store queried IP locations. This is done to reduce the number of calls made to the selected service, as some of them are rate limited.

Options:

  • all all location are cached
  • some cache only the requesting user
  • none caching is completely disable

Saturday, October 14, 2023

Common linux commands

  1. whoami
  2. man 
  3. clear 
  4. pwd
  5. ls
  6. cd 
  7. mkdir 
  8. touch 
  9. rmdir 
  10. rm 
  11. open 
  12. mv 
  13. cp 
  14. head
  15. tail 
  16. date
  17. cat
  18. less 
  19. echo 
  20. wc 
  21. piping 
  22. sort
  23. uniq 
  24. expansions 
  25. diff 
  26. find 
  27. grep
  28. du
  29. df 
  30. history
  31. ps
  32. top 
  33. kill
  34. killall
  35. gzip
  36. gunzip
  37. tar
  38. nano
  39. alias 
  40. xargs
  41. ln
  42. who
  43. su 
  44. sudo 
  45. passwd
  46. chown
  47. chmod

Sunday, October 8, 2023

Thursday, October 5, 2023

Export multiple records one by one from Excel

 

Sub Print1()

    For a = 1 To 10

        Sheet3.Range("L2").Value = a

ActiveWindow.SelectedSheets.PrintOut copies:=1, collate:=True, IgnorePrintAreas:=False

Next

End Sub

Export multiple records to PDF one by one from Excel

 Sub ExportRangeToPDF()

    For a = 3 To 10

        Sheet1.Range("D4").Value = Sheet2.Cells(a, "A")

        Sheet1.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\Naeem\OneDrive\Desktop\PrintingPDF\" & Sheet1.Range("D4").Value & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False

    Next

End Sub

Extract Domain from email in Excel or Google sheet

  =TEXTAFTER( A2 , "@") or, =MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))