Skip to content

Instantly share code, notes, and snippets.

View ilovefreesw's full-sized avatar
🎯
Focusing

Laxman ilovefreesw

🎯
Focusing
View GitHub Profile
@ilovefreesw
ilovefreesw / code.gs
Last active March 23, 2021 07:13
Google Sheets Apps Script to get WordPress Post ID from URL
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 March 23, 2021 07:03 — forked from Suleman-Elahi/wptags.py
Get All WordPress Tags in Excel (CSV) using WordPress WP API v2
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 / 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.
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 / 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.
forfiles /s /m *.gif /c "cmd /c mkdir @FNAME && ffmpeg -i "@FILE" @FNAME/output_%%04d.jpg"
@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"
@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 / 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 / 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 / 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 / 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);