Skip to content

Instantly share code, notes, and snippets.

@greg-randall
greg-randall / site_scooper.sh
Last active May 23, 2023 20:12
Site Scooper. Give the script a URL and it'll build a list of pages on the site and then download and render the pages using chromium. Built off my Site Map gist. You'll probably need to install chromium, but otherwise the tools are pretty standard.
#example: ./site_scooper.sh asdf.com
#if it doesn't work, check your url, and see if it redirects from asdf.com to www.asdf.com, and retry with www.asdf.com
SITE=$1
URLS="$1_urls.txt"
echo -e "Starting Sitemap Generation===============================================\n"
echo "" > site_url_list_raw.txt
@greg-randall
greg-randall / site_map.sh
Last active March 9, 2022 14:40
Generate a list of all the urls on a website. Ignores common files like jpg, pdf, js, css, etc.
#example: ./site_map.sh asdf.com
SITE=$1
URLS="$1_urls.txt"
echo -e "Starting Sitemap Generation===============================================\n"
echo "" > site_url_list_raw.txt
@greg-randall
greg-randall / gist:b6dbcb64c90b78c3e17efba19ff9ad61
Created February 15, 2022 18:58
Save output from get/post for testing.
<?php
$data = "\n---------------------------------------------------------------------\nRaw Input:\n" . file_get_contents("php://input");
$data .= "\n\nGet:\n". print_r($_GET,true);
$data .= "\nPost:\n". print_r($_POST,true);
file_put_contents( "log-output-test.txt", $data , FILE_APPEND | LOCK_EX );
@greg-randall
greg-randall / gist:44dd0f535d7f9671a959c64ee0634c3f
Last active March 23, 2023 14:39
Convert a folder of PDFs to JPGs at web resolutions, and replace spaces with underscores while we're at it.
rename "s/[\s()]/_/g" *; rename "s/_+/_/g" * ; find *.pdf -exec convert -colorspace sRGB -density 150 {} -background white -alpha remove -alpha off -resize 1600x1600 -quality 100 {}.jpg \;
@greg-randall
greg-randall / index.php
Created February 10, 2022 16:21
Generate json file for the WordPress plugin Redirection.
<pre>
<?php
//built to generate a json file for https://wordpress.org/plugins/redirection/
//might want to run this through a json validator before uploading. there isnt any checking to make sure things worked correctly
//paste two columns from excel here.
//make sure to have trailing slashes
$data = "/thing/asdf/ /other-thing/qwerty/
/ideas/ /better-ideas/";
@greg-randall
greg-randall / gist:d321fb18e78a66695c6fa0cb06fad838
Created February 9, 2022 15:22
Check a folder of XML files against a XSD file.
find *.xml -exec xmllint --schema Schema.xsd --noout {} \;
@greg-randall
greg-randall / gist:2fe5e8742f6e69b5d1a60b06680e7c5e
Last active December 17, 2021 19:46
Add a translucent color over a background image in a webpage. https://jsfiddle.net/Lmy6jw03/1/
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><rect style='fill:rgb(41,114,183);' width='100%' height='100%' opacity='0.75' /></svg>"), url('img/background.jpg');
@greg-randall
greg-randall / gist:0a5d5cbb79d8c5b276a363836204b318
Created December 17, 2021 13:28
Make some boxes on a website the same height. Add a common class name to the boxes, and swap out your class name for ".class-name-of-box". Requires jQuery.
<script>
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
@greg-randall
greg-randall / check.sh
Last active December 9, 2021 15:31
Scans a list of domains for their WordPress version and outputs a CSV.
FILENAME="domains.txt"
LINES=$(cat $FILENAME)
echo "Domain, Version" > domains_with_versions.csv
for LINE in $LINES
do
CHECKLOCATION="${LINE}/feed/"
@greg-randall
greg-randall / split.sh
Created October 17, 2021 20:39
Split jpg Samsung Gear 360 2017
#!/bin/bash
#place in a folder with gear 360 images, and it'll split them into the two images.
if [ ! -d "split" ]
then
mkdir split
fi
for i in *