From d2e4da10c806d815eded44ade076babb78802c16 Mon Sep 17 00:00:00 2001 From: Bradley Taunt Date: Mon, 22 Jan 2024 13:06:19 -0500 Subject: Initial commit to new cgit platform --- scripts/_stats-script.js | 9 +++++++++ scripts/generate.sh | 13 +++++++++++++ scripts/local.sh | 2 ++ scripts/website-check.rb | 20 ++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 scripts/_stats-script.js create mode 100644 scripts/generate.sh create mode 100644 scripts/local.sh create mode 100644 scripts/website-check.rb (limited to 'scripts') diff --git a/scripts/_stats-script.js b/scripts/_stats-script.js new file mode 100644 index 0000000..43b795e --- /dev/null +++ b/scripts/_stats-script.js @@ -0,0 +1,9 @@ +updateSubTotal(); // Initial call + +function updateSubTotal() { + var table = document.getElementById("myTable"); + let subTotal = Array.from(table.rows).slice(1).reduce((total, row) => { + return total + parseFloat(row.cells[1].innerHTML); + }, 0); + document.getElementById("val").innerHTML = "SubTotal =" + (subTotal.toFixed(2) / 742); +} diff --git a/scripts/generate.sh b/scripts/generate.sh new file mode 100644 index 0000000..a421a38 --- /dev/null +++ b/scripts/generate.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +#define parameters which are passed in. +SIZE=$1 +URL=$2 + +#define the template. +cat << EOF +--- +pageurl: $URL +size: $SIZE +--- +EOF diff --git a/scripts/local.sh b/scripts/local.sh new file mode 100644 index 0000000..bed6aaf --- /dev/null +++ b/scripts/local.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker run -p 4000:4000 -v $(pwd):/site bretfisher/jekyll-serve diff --git a/scripts/website-check.rb b/scripts/website-check.rb new file mode 100644 index 0000000..48adab5 --- /dev/null +++ b/scripts/website-check.rb @@ -0,0 +1,20 @@ +require 'httparty' +require 'nokogiri' + +HTTParty::Basement.default_options.update(verify: false) + +response = HTTParty.get('https://1mb.club') + +document = Nokogiri::HTML(response.body) +website_urls = document.css("#container tr") + +puts "Scanning website members URLs..." +website_urls.each do |single_site| + begin + url = single_site.css("a.site").first.attribute("href").value + response = HTTParty.get(url, timeout: 4) + puts "Checking: " + url + rescue Exception + puts "