Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Laxman ilovefreesw

🎯
Focusing
View GitHub Profile
@ilovefreesw
ilovefreesw / code.gs
Last active Mar 23, 2021
Google Sheets Apps Script to get WordPress Post ID from URL
View code.gs
function getPostID(link) {
var slug = link.split("/").pop().split(";")[0].replace(".html","");
var url = 'https://www.ilovefreesoftware.com/wp-json/wp/v2/posts?slug='+slug;
var response = JSON.parse(UrlFetchApp.fetch(url).getContentText())
return response[0]['id'];
}
//funtion to get sluf from URL only
/*function getSlug(data) {
@ilovefreesw
ilovefreesw / wptags.py
Created Mar 23, 2021 — forked from Suleman-Elahi/wptags.py
Get All WordPress Tags in Excel (CSV) using WordPress WP API v2
View wptags.py
import requests
import csv
import time
from tqdm import tqdm
tags = {}
pages = int(requests.get('https://www.example.com/wp-json/wp/v2/tags').headers['X-WP-TotalPages'])
for i in tqdm(range(pages), ncols=65):
js = requests.get('https://www.example.com/wp-json/wp/v2/tags?page='+str(i+1)).json()
@ilovefreesw
ilovefreesw / webhook_code.gs
Created Oct 20, 2021
Google Sheet Webhook Receiver. Recives JSON data posted on the webhook URL. Puts timestamp and JSON data in the Google Sheet.
View webhook_code.gs
//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 / installer.bat
Created Oct 28, 2021
Install Android Apps in Windows 11 by Double Clicking. Make sure Platform-Tools which contains ADB is in PATH.
View installer.bat
@echo off
set "package=%1"
adb connect 127.0.0.1:58526
adb install %package%
EXIT /B
pause
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
}
@ilovefreesw
ilovefreesw / bulk_webpage_screenshots.py
Last active Sep 21, 2022
A Python-Selenium script to bulk take screenshots of webpage using headless Chrome by reading a text file full of URLs
View bulk_webpage_screenshots.py
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from tqdm import tqdm
import time
lines = []
Links_File = r''
OP_DIR = r''
i = 1
@ilovefreesw
ilovefreesw / unpinall.bat
Created Dec 23, 2021
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
ilovefreesw / pdfcompress.py
Created Dec 30, 2021
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.
View pdfcompress.py
from __future__ import print_function
import os
import subprocess
root = "."
try:
os.mkdir('compressed')
except FileExistsError:
pass
@ilovefreesw
ilovefreesw / WpBroken.py
Last active Mar 30, 2022
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.
View WpBroken.py
import requests
import csv
import concurrent.futures
import sys, time
import bs4
domain = sys.argv[1]
csv_file = sys.argv[2]
headers = {
@ilovefreesw
ilovefreesw / reg.bat
Created Mar 24, 2022
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