Skip to content

Instantly share code, notes, and snippets.

View ilovefreesw's full-sized avatar
🎯
Focusing

Laxman ilovefreesw

🎯
Focusing
View GitHub Profile
@ilovefreesw
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.
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
ilovefreesw / pdfcompress.py
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 = "."
try:
os.mkdir('compressed')
except FileExistsError:
pass
@ilovefreesw
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.
$trigger=New-JobTrigger -Weekly -At "7:00AM" -DaysOfWeek "Monday"
$action="PowerShell.exe -ExecutionPolicy ByPass -File D:\Logs\export-logs.ps1"
$sb=[Scriptblock]::Create($action)
Register-ScheduledJob -Name "Export Logs" -ScriptBlock $sb -Trigger $trigger
@ilovefreesw
ilovefreesw / bulk_webpage_to_pdf.ps1
Last active October 4, 2023 07:18
A powershelll script to bulk convert webpages to PDF using headless Chrome. Save PDF with numberic names or based on webpage title.
$sourceFile = " " # the source file containing the URLs you want to convert
$destFolder = " " # converted PDFs will be saved here. Folder has to exist. Don't forget to make sure that this path must end with "/"
$num = 1
foreach ($link in [System.IO.File]::ReadLines($sourceFile))
{
$outfile = $num.ToString() + '.pdf'
$outputPath = Join-Path -Path $destFolder -ChildPath $outfile
& 'C:\Program Files\Google\Chrome\Application\chrome.exe' --headless --print-to-pdf="$outputPath" "$link"
Start-Sleep -Seconds 3
@ilovefreesw
ilovefreesw / webhook_code.gs
Created October 20, 2021 04:29
Google Sheet Webhook Receiver. Recives JSON data posted on the webhook URL. Puts timestamp and JSON data in the Google Sheet.
//this is a function that fires when the webapp receives a GET request
function doGet(e) {
return HtmlService.createHtmlOutput("request received");
}
//this is a function that fires when the webapp receives a POST request
function doPost(e) {
var params = JSON.stringify(e.postData.contents);
params = JSON.parse(params);
var myData = JSON.parse(e.postData.contents);
@ilovefreesw
ilovefreesw / bulk_webpage_screenshots.py
Last active May 4, 2023 09:54
A Python-Selenium script to bulk take screenshots of webpage using headless Chrome by reading a text file full of URLs Tutorial: https://www.ilovefreesoftware.com/26/tutorial/how-to-take-full-page-screenshot-in-bulk-from-multiple-urls.html
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.common.by import By
from tqdm import tqdm
import time
lines = []
Links_File = r''
OP_DIR = r''
i = 1
@ilovefreesw
ilovefreesw / WpBroken.py
Last active April 6, 2023 01:01
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
ilovefreesw / installer.bat
Created October 28, 2021 10:57
Install Android Apps in Windows 11 by Double Clicking. Make sure Platform-Tools which contains ADB is in PATH.
@echo off
set "package=%1"
adb connect 127.0.0.1:58526
adb install %package%
EXIT /B
pause
@ilovefreesw
ilovefreesw / AMPTools-Gen.py
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.
#!/usr/bin/python3
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
ilovefreesw / gAdsDownload.py
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"] = "www.google.com"