Skip to content

Instantly share code, notes, and snippets.

View najathi's full-sized avatar
💻
Developing

Najathi najathi

💻
Developing
View GitHub Profile
@najathi
najathi / checkPawnedPasswords.php
Created February 22, 2021 05:00
Simple method to check the Pwned Passwords API using PHP
<?php
/**
* Simple method to use the API from https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/
* Written by Jim Westergren and released to public domain
* @return int count
*/
function checkPawnedPasswords(string $password) : int
{
$sha1 = strtoupper(sha1($password));
$data = file_get_contents('https://api.pwnedpasswords.com/range/'.substr($sha1, 0, 5));
@najathi
najathi / npm-scss-config
Created February 22, 2021 09:04
setup scss file in html
1. npm --version
2. npm init -y (or) npm init
3. npm install node-sass (or) npm install node-sass -D
4. run before add some changes on package.json file
"scripts": {
"sass": "node-sass -w scss/ -o dist/css --recursive"
}
1. npm --version
2. npm init -y (or) npm init
3. npm install node-sass (or) npm install node-sass -D
4. run before add some changes on package.json file
"scripts": {
"sass": "node-sass -w scss/ -o dist/css --recursive"
}
@najathi
najathi / aws-s3-backet-download.txt
Created September 14, 2021 19:42
Downloading an entire AWS S3 bucket?
100% works for me, i have download all files from aws s3 backet.
1. install aws cli (and select your operating system , follow the steps) https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html
2. check aws version: aws --version
3. run config command: aws configure
4. aws s3 cp s3://yourbucketname your\local\path --recursive
Eg (Windows): aws s3 cp s3://yourbucketname C:\aws-s3-backup\webuybrokenphones --recursive
check out this link: https://www.edureka.co/community/32955/how-to-download-an-entire-bucket-from-s3-to-local-folder
@najathi
najathi / controller.php
Last active December 16, 2021 12:02
Add New sheet and data
public function addOrderProperty()
{
$sheets = Sheets::spreadsheet(config('sheets.post_spreadsheet_id'))->sheetList();
$now = now()->year . '/' . now()->month;
$id = Arr::get(array_flip($sheets), $now);
if (is_null($id)) {
$body = new \Google_Service_Sheets_BatchUpdateSpreadsheetRequest(array(
'requests' => array(
@najathi
najathi / script.sh
Created January 3, 2022 09:37
cpanel cron job
#! /bin/sh
/usr/bin/php /home/username/public_html/project_name/artisan schedule:run 1>> /dev/null 2>&1
@najathi
najathi / commad
Created February 13, 2022 19:30
Class 'League\Flysystem\AwsS3v3\AwsS3Adapter' Laravel 8 or Luman 8
below laravel 8
composer require league/flysystem-aws-s3-v3 "~1.0"
For laravel 8 use
composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0"
@najathi
najathi / images_to_webp.txt
Last active May 10, 2022 19:12
jpg, png, gif, .etc. to webp using choco with webp
1. install the choco
https://docs.chocolatey.org/en-us/choco/setup
2.choco install webp
more info, checkout here
https://www.smashingmagazine.com/2018/07/converting-images-to-webp/
3. a file conversion
cwebp -q 75 test.jpg -o output.webp
@najathi
najathi / power_shell.txt
Created February 27, 2022 04:58
Bulk rename
Bulk rename the files
$i=1
Get-ChildItem *.webp | %{Rename-Item $_ -NewName ('{0}.webp' -f $i++)}