Skip to content

Instantly share code, notes, and snippets.

View bhandarisaurav's full-sized avatar
💻
Full Stack Software Developer

Saurav Bhandari bhandarisaurav

💻
Full Stack Software Developer
View GitHub Profile
@bhandarisaurav
bhandarisaurav / difference.js
Created September 25, 2021 23:54
get difference of 2 objects
function difference(object, base) {
function changes(object, base) {
return _.transform(object, function (result, value, key) {
if (!_.isEqual(value, base[key])) {
result[key] =
_.isObject(value) && _.isObject(base[key])
? changes(value, base[key])
: value;
}
@bhandarisaurav
bhandarisaurav / 1dynamicCertificate.php
Last active December 17, 2018 10:31
Dynamic Certificate Generation Using FPDF and FPDI in PHP | Download the pdf Template here : https://goo.gl/ZRXtLt
<?php
use setasign\Fpdi\Fpdi;
require_once('vendor/setasign/fpdf/fpdf.php');
require_once('vendor/autoload.php');
global $pdf;
if (1) {
@bhandarisaurav
bhandarisaurav / getPrivateIP.js
Created December 17, 2018 10:05
Get System's Private IP Address | The Private IP address is displayed into the html tag with id = list or it is set as cookie and can be read easily.
var RTCPeerConnection = window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
if (RTCPeerConnection) (function () {
var rtc = new RTCPeerConnection({iceServers:[]});
if (1 || window.mozRTCPeerConnection) { // FF [and now Chrome!] needs a channel/stream to proceed
rtc.createDataChannel('', {reliable:false});
}
rtc.onicecandidate = function (evt) {
if (evt.candidate) grepSDP("a="+evt.candidate.candidate);
};
@bhandarisaurav
bhandarisaurav / getPublicIP.js
Created December 17, 2018 09:59
Get System's Public IP Address
$(document).ready(function () {
var xmlhttp = new XMLHttpRequest();
var url = "http://ipecho.net/plain";
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
IP = this.responseText;
// IP variable stores the PUBLIC IP address of the system
//for eg 110.44.116.42
}
Finally a tool to activate windows as well as Office at the same time. Download From the url.
@bhandarisaurav
bhandarisaurav / Merge Multiple PPT VBA
Created September 6, 2018 07:08
Simple VBA Script to merge or combine all the powerpoint files in a folder into a new one! Steps: Open a new presentation file and save it to the folder all the files you want to combine are in (you can move it later) Paste the code into the VBA window Run the InsertAllSlides macro and it will combine them.
Sub InsertAllSlides()
' Insert all slides from all presentations in the same folder as this one
' INTO this one; do not attempt to insert THIS file into itself, though.
Dim vArray() As String
Dim x As Long
' Change "*.PPT" to "*.PPTX" or whatever if necessary:
EnumerateFiles ActivePresentation.Path & "\", "*.PPTX", vArray
@bhandarisaurav
bhandarisaurav / Batch Renamer.xlxs
Last active May 20, 2020 22:48
Macro code to Rename all files in a folder with the new names on Excel sheet!!!. List all original filenames in one column A, and you should type new filenames in column B. Then press ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications Window. Now paste this code and press F5.
Sub RenameFiles()
'Updateby20141124
Dim xDir As String
Dim xFile As String
Dim xRow As Long
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
xDir = .SelectedItems(1)
xFile = Dir(xDir & Application.PathSeparator & "*")
@bhandarisaurav
bhandarisaurav / PHP Mailer.php
Last active August 8, 2018 08:50
Simple script made with PHP mailer that helps to send emails for the project. Simply put your gmail username and password in the respective place and write the sending address and you are ready to go. Download the required files here : https://goo.gl/W9WbW5
<?php require 'class/class.phpmailer.php';
if (isset($_POST["submit"])) {
$name = $_POST['name'];
$bodyContent = "hello ".$name;
$mail = new PHPMailer;
$mail->CharSet = "UTF-8";
$mail->IsSMTP(); //Sets Mailer to send message using SMTP
@bhandarisaurav
bhandarisaurav / Online KMS Activator.cmd
Last active October 4, 2024 15:29
Activate Windows & Office for 180 Days with online KMS Servers. This script does not install any files in your system and it clears all the leftovers including kms server name after the Activation. For Successful Activation, Internet Must be connected.
@echo off
::::::::::::::::::::::::::::
set "params=Problem_with_elevating_UAC_for_Administrator_Privileges"&if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
fsutil dirty query %systemdrive% >nul 2>&1 && goto :GotPrivileges
:: The following test is to avoid infinite looping if elevating UAC for Administrator Privileges failed
If "%1"=="%params%" (echo Elevating UAC for Administrator Privileges failed&echo Right click on the script and select 'Run as administrator'&echo Press any key to exit...&pause>nul 2>&1&exit)
cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%params%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs"&exit
:GotPrivileges
::::::::::::::::::::::::::::
color 1F