Skip to content

Instantly share code, notes, and snippets.


Laxman ilovefreesw

View GitHub Profile
ilovefreesw / PS command
Created December 30, 2022 07:40
A PowerShell script to automatically backup Windows Event Logs. Add it to Windows Task Scheduler using the Command Below.
View PS command
$trigger=New-JobTrigger -Weekly -At "7:00AM" -DaysOfWeek "Monday"
$action="PowerShell.exe -ExecutionPolicy ByPass -File D:\Logs\export-logs.ps1"
Register-ScheduledJob -Name "Export Logs" -ScriptBlock $sb -Trigger $trigger
ilovefreesw /
Created August 8, 2022 04:31
AMPTools-Gen is basically a Python script that you can use to instantly generate AMP code from any HTML.
import argparse
from amp_tools import TransformHtmlToAmp
import codecs
arg_parser = argparse.ArgumentParser( description = "Copy source_file as target_file." )
arg_parser.add_argument( "source_file" )
arg_parser.add_argument( "target_file" )
arguments = arg_parser.parse_args()
ilovefreesw /
Created May 28, 2022 07:06
A simple script to get all Google Ads from Google Search results directly. Downloads ad title, link, and description.
from bs4 import BeautifulSoup
import requests, csv
import lxml
from requests.structures import CaseInsensitiveDict
ads = []
key = input("Enter a keyword/domain/brand: ")
headers = CaseInsensitiveDict()
headers["authority"] = ""
ilovefreesw / gist:cf66d97e56d2a7081d95a85715c46172
Created May 19, 2022 04:52
Here is a batch script to bulk split GIF files into their corresponding frames in JPG format. Based on FFmpeg. So make sure that FFmpeg command is available.
View gist:cf66d97e56d2a7081d95a85715c46172
forfiles /s /m *.gif /c "cmd /c mkdir @FNAME && ffmpeg -i "@FILE" @FNAME/output_%%04d.jpg"
ilovefreesw / reg.bat
Created March 24, 2022 07:17
A batch script for Windows to Fix "Some settings are managed by your organization". Works on Windows 10 and Windows 11.
View reg.bat
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies" /f
reg delete "HKCU\Software\Microsoft\WindowsSelfHost" /f
reg delete "HKCU\Software\Policies" /f
reg delete "HKLM\Software\Microsoft\Policies" /f
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies" /f
reg delete "HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" /f
reg delete "HKLM\Software\Microsoft\WindowsSelfHost" /f
reg delete "HKLM\Software\Policies" /f
reg delete "HKLM\Software\WOW6432Node\Microsoft\Policies" /f
reg delete "HKLM\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" /f
ilovefreesw /
Last active March 30, 2022 10:37
A script to check links in all the WordPress posts to find out broken ones. Saves the report in CSV file. Based on WordPress API and only needs domain as input.
import requests
import csv
import concurrent.futures
import sys, time
import bs4
domain = sys.argv[1]
csv_file = sys.argv[2]
headers = {
ilovefreesw /
Created December 30, 2021 12:53
A Python script to batch compress PDF files on Windows, MAC, and Linux. Make sure gs and Python are in PATH before running this script.
from __future__ import print_function
import os
import subprocess
root = "."
except FileExistsError:
ilovefreesw / unpinall.bat
Created December 23, 2021 12:55
A batch file to Unpin all Taskbar items in one go. Works on Windows 11 and Windows 10.
View unpinall.bat
DEL /F /S /Q /A "%AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar\*"
REG DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband /F
taskkill /F /IM explorer.exe & start explorer
ilovefreesw /
Last active January 10, 2023 13:57
A Python-Selenium script to bulk take screenshots of webpage using headless Chrome by reading a text file full of URLs Tutorial:
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from import By
from tqdm import tqdm
import time
lines = []
Links_File = r''
OP_DIR = r''
i = 1
View bulk_webpage_to_pdf.ps1
$sourceFile = "" # the source file containing the URLs you want to convert
$destFolder = "" # converted PDFs will be saved here. Folder has to exist.
$num = 1
foreach($link in [System.IO.File]::ReadLines($sourceFile))
$outfile = $num.ToString() + '.pdf'
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' --headless --print-to-pdf="$destFolder $outfile" "$link"
Start-Sleep -s 3