2024-04-03 08:28:56 *---- "Ascii" include("WBInclusions") APFS = "014" # Ascii:APFS global versionNr = APFS[2:3] # I (BMcC) was thoroughly enraged in trying to fix up this script. global nr = 1 global clr = 30 global defaultClr = Sys.iswindows() ? "33" : "31" if length(ARGS) == 2 colr = tryparse(Int64, ARGS[2]) if colr == nothing println("\n Color not numeric: ", ARGS) exit(16) end defaultClr = string(colr) end global lenArgs = length(ARGS) global FUCKEDUP = lenArgs > 0 ? lowercase(ARGS[1]) : "" if FUCKEDUP == "ext" global FUCKEDUP = "extended" end if !(lenArgs == 0 || FUCKEDUP in ["extended", "plain"]) println("\n Parameters fucked up: ", ARGS) exit(16) end rng = FUCKEDUP == "extended" ? [160 : 175] : [32 : 47] println(lenArgs > 1 ? "\n \033[28;1m28 \033[29;1m29 \033[30;1m30 \033[31;1m31 \033[32;1m32 \033[32;1m32 " * "\033[33;1m33 \033[34;1m34 \033[35;1m35 \033[36;1m36 \033[37;1m37 \033[38;1m38\033[0m " * "(v" * APFS * ")\n" : "\n") hexes = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"] if length(ARGS) == 0 println(LO_GRAY * " 2 3 4 5 6 7" * HI_END) end for i = rng[1] for j = 0 : 5 k = i + j * 16 print(" ", k == 127 ? "[" : HI_COLOR(defaultClr) * Char(k) * HI_END, k < 100 ? " " : k == 127 ? HI_YELLOW * "v" * HI_END : " " , k == 127 ? HI_YELLOW * versionNr * HI_END * "]" : string(k)) # for 127 show version number! end print(" " * LO_GRAY * hexes[1 + mod(i, 16)] * HI_END * "\n") if clr == 37 global clr = 90 else global clr += 1 end global nr += 1 end *---- "Hexprint" include("WBInclusions") APFS = "021" # Hexprint:APFS version = "v" * APFS * " +2023.07.21" # Adding the kludge speeded up a search of 600K file from 175 sec to > 1 sec global MYARGS = ARGS global DOSSY = false t = time() function myPrint(fn, offshit::Int64=0, maxShit::Int64=9999999) offset = Int(floor(offshit / 16)) * 16 maxLen = Int(floor((maxShit + 15) / 16)) * 16 if (length(fn)) < 1 return("\n NO ARGUMENT\n\n") end notGood = false hexChars = "0123456789ABCDEF" everything = "" everyin = "" p4 = 0 try t = RRead(fn, "raw") if length(MYARGS) > 3 if MYARGS[4] == "=" MYARGS[4] = MYARGS[2] end p4 = tryparse(Int64, MYARGS[4]) p4 = Int(floor(p4 / 16)) * 16 + 1 t = t[p4:length(t)] p4 -= 1 end rlim = lent = length(t) if offset < 0 offset = Int(floor((rlim + offset) / 16)) * 16 end taboo = offset + maxLen if rlim > taboo rlim = taboo end for i = 1:rlim # length(t) r = hexChars[1 + (Int(floor(t[i] % 16)))] q = hexChars[1 + (Int(floor(t[i] / 16)))] everything *= string(q,r, " ") if t[i] < 32 || t[i] > 127 if t[i] == 13 || t[i] == 9 global DOSSY = true end everyin *= "." else everyin *= string(Char(t[i])) end end hx = string(offset, base = 16) println("\n HexPrint " * version * "\n " * fn * " (" * string(lent) * ": " * string(offset) * " ~ " * string(rlim) * ", 0x" * hx * (p4 == 0 ? "" : " \033[31;1mKLUDGE!\033[0m") * ")\n") shit = Int(floor(length(everyin) % 16)) if shit > 0 shit = 16 - shit everyin *= " "[1:shit] everything *= " "[1:( 3 * shit)] end # 30 2F 54 65 78 74 42 75 62 62 6C 65 2E 6A 70 67 22 | /TextBubble.jpg" | 48 rl = offset # tryparse(Int64,offset) while rl < rlim stain = " " * string(string(rl + p4, base = 16)) stain = stain[(length(stain) - 5):length(stain)] omg = everything[(3 * rl + 1):(3 * rl + 23)] * " " * everything[(3 * rl + 24):(3 * rl + 48)] stain2 = stain * " " * replace(omg, r"([89ABCDEF][0123456789ABCDEF]|0[0123456789BCDEF])" => s"\e[31;1m\1\e[0m") * HI_YELLOW * " |" * HI_END * " " * everyin[(rl + 1):(rl + 16)] * " " * HI_YELLOW * "|" * HI_END * " " * string(rl + p4) println(stain2) rl += 16 end catch ex println("Exception: ", ex) notGood = true finally if notGood == false print("\n CLOSED: ") else print("\n NOTGOOD: ") end println(fn) # * "\n") end end p1 = "" p2 = 0 p3 = 99999999 if length(MYARGS) > 2 # 3 p1 = MYARGS[1] # filename p2 = length(MYARGS) > 3 ? 0 : tryparse(Int64, MYARGS[2]) # offset p3 = tryparse(Int64, MYARGS[3]) # length elseif length(MYARGS) == 2 p1 = MYARGS[1] p2 = tryparse(Int64, MYARGS[2]) elseif length(MYARGS) == 1 p1 = MYARGS[1] else println("\n Hexprint Filename [start [ length [ kludge ] ] ]") exit(16) end myPrint(p1,p2,p3) println(" E/t: " , formatDecimal(time() - t, 3), DOSSY ? " " * HI_RED * "DOS lineend(s) or tab(s) detected" * HI_END : "") *---- "Sc9" include("WBInclusions") if length(ARGS) < 1 println(" Need a string to search for") exit(16) end global str = Regex(replace(replace(ARGS[1], "%%1%" => "^"), "%%2%" => ">") , "i") global VERSION = "015" global BASE = "/ROM/BO/c9/" global DIRS = 0 global DISCARDS = 0 global PROCESSED = 0 global HITS = [] global SIZE = 0 global HREFS = 0 global SRCS = 0 function RD(dir) global DIRS += 1 # println(" dir: \"",dir, "\"") files = readdir(dir) for f in files if isdir(dir * f) RD(dir * f * "/") continue end if !endswith(f, ".html") global DISCARDS += 1 continue end ff = dir * f b = RRead(ff, "asis") c = findall(str, b) if length(c) > 0 fff = replace(ff[length(BASE) + 1 : length(ff)], "/" => "\\") push!(HITS, [ff, length(c)]) #println(" ", fff) end global HREFS += length(findall(" href=\"", b)) global SRCS += length(findall(" src=\"", b)) global PROCESSED += 1 global SIZE += length(b) end end println("") RD(BASE) println(" PROCESSED: ", PROCESSED, ". DIRS: ", DIRS, ". DISCARDS: " , DISCARDS, ". > JUNK6.html. (", formatFixed(SIZE) , " ", formatFixed(HREFS), " ", formatFixed(SRCS) * ")") a = open("JUNK6.html", "w") write(a, "\n\n\n\nFrustra\n\n\n\n
\n\n\n") global SHIT = Dict{String, Any}() for i = 1 : length(HITS) hit = HITS[i] h = hit[1] pfx = length(findall("/", h)) > 4 ? "0" : "1" SHIT[pfx * lowercase(h)] = hit end global kk = [] for k in keys(SHIT) push!(kk, string(k)) end kkk = sort(kk) global PREVX = "X" for kkkk in kkk shit = SHIT[kkkk] h = shit[1] hlen = shit[2] kkkk1 = kkkk[1:1] sz = kkkk1 != PREVX ? 12 : 0 write(a, "\n") global PREVX = kkkk1 end write(a,"
" * string(str) * "
" * h[12 : length(h)] * "" * string(hlen) * "
\n\n") close(a) *---- "TzMulti" using Random include("WBInclusions") Version = "026" if length(ARGS) == 0 println("\nTzMulti v" * Version * ". Input: [seedNumber | \"x\"] [text | *filename]\n\n" * " * Take a newspaper.\n * Take some scissors.\n * Choose from this paper an article the length you want to make your poem.\n" * " * Cut out the article.\n * Next carefully cut out each of the words that make up this article and\n put them all in a bag.\n" * " * Shake gently.\n * Next take out each cutting one after the other.\n * Copy conscientiously in the order in which they left the bag.\n" * " * The poem will resemble you.\n * And there you are--an infinitely original author of charming sensibility,\n" * " even though unappreciated by the vulgar herd.\n * (Tristan Tzara)") exit(16) end global ARGS2 = ARGS[2] if ARGS2[1:1] == "*" global ARGS2 = RRead(ARGS2[2 : length(ARGS2)], "asis") end global Data0 = split(replace(replace(replace(replace(replace(strip(ARGS2), r"[\r\n]" => " "), r"\-\-+" => ""), r"[^a-zA-Z0-9'\- ]" => ""), r" +" => " "), r" (Mr|Mrs|Mx|Dr|Prof|Messrs) " => s" \1. "), # r" ( '|' )" => " "), " ") global CHARS = 0 for itm in Data0 global CHARS += length(itm) end global Data = copy(Data0) global DataJoin = join(Data0, " ") if (global Seed = tryparse(Int32, ARGS[1])) == nothing global Seed = 0 for chr in DataJoin global Seed += Int32(chr) end end global Fortuna = rand(MersenneTwister(Seed), UInt64, length(Data)) global Out = "" for ix = 1 : 999999 len = length(Data) if len == 1 break end thisIndex = (Fortuna[ix] % len) + 1 global Out *= Data[thisIndex] * " " deleteat!(Data, thisIndex) end global Out *= Data[1] println("\n TzMulti v" * Version * " Seed: " * string(Seed) * " (" * string(CHARS) * ":" * string(length(Data0)) * ")\n\n " * HI_YELLOW * DataJoin * HI_END) println("\n " * HI_RED * Out *HI_END) *---- "BP" include("WBInclusions") # Not using noww() function here global version = "029" global fn = "w\\txts\\BP" global displayCt = 16 global ARGZ = copy(ARGS) global lenARGZ = length(ARGZ) # Cheat against myself. NumberS are seeming to be too low. if lenARGZ == 6 global ARGZ = [string(max(parse(Int32, ARGZ[1]), parse(Int32, ARGZ[4]))), string(max(parse(Int32, ARGZ[2]), parse(Int32, ARGZ[5]))), string(max(parse(Int32, ARGZ[3]), parse(Int32, ARGZ[6])))] global lenARGZ = length(ARGZ) end global MAAAS = 0 global MAAAD = 0 global MINMINS = 99999 global MINMIND = 99999 struct ITEM s d end function pushDown(itm, arry) return append!([itm],arry[1:length(arry) - 1]) end global ThisDayTotS = 0 global ThisDayTotD = 0 global LenThisDay = 0 global IgnoredLines = 0 global EODs = Dict{String,Array{ITEM}}() if lenARGZ == 0 # Go to display current file contents elseif lenARGZ == 1 global displayCt = tryparse(Int32, ARGZ[1]) elseif lenARGZ != 3 println("Wrong number arguments") exit(16) else if !isfile(fn) close(open(fn, "w")) end global nowwRaw = now() global nowww = string(nowwRaw) global nowww_HM = nowww[12:16] prev = split(RRead(fn, "asis"), "\n") lenPrev = length(prev) global lds = lenPrev if lenPrev > 0 while true if prev[lds][3:12] != " " break end global lds = lds - 1 end end if length(ARGZ[1]) != 3 || length(ARGZ[2]) != 2 || !(length(ARGZ[3]) in [2,3]) println("\nAsshole parameter length: ", ARGZ) exit(16) end global Join_ARGZ_Original = ARGZ[1] * " " * ARGZ[2] * (length(ARGZ[3]) == 2 ? " " : " ") * ARGZ[3] global Join_ARGZ = ARGZ[1] * " " * ARGZ[2] * " " * (length(ARGZ[3]) == 2 ? ARGZ[3] : "99") if findfirst(r"^[12]\d{2} [56789]\d [456789]\d$", Join_ARGZ) == nothing println("\nInput bad: ", ARGZ) exit(16) end cur = replace(nowww, r"T(.{5}).*" => s" \1") * " " * Join_ARGZ_Original global doy = "000" * string(dayofyear(nowwRaw) + (cur[1:4] == "2024" ? 365 : 0)) lenDoy = length(doy) global doy = " " * doy[lenDoy - 3: lenDoy] if lenPrev == 0 b = open(fn, "w") write(b, " " * cur * doy) else b = open(fn, "a") if cur[1:10] == prev[lds][3:12] write(b, "\n " * cur[11:length(cur)] * doy) else write(b, "\n " * cur * doy) end end close(b) end global all = [] linesIn = split(RRead(fn, "asis"), "\n") for itm in linesIn if length(itm) < 1 || itm[1:1] == "#" global IgnoredLines += 1 continue end push!(all, itm) # push! inserts at the end not the beginning of the list end global hiD = 0 global hiS = 0 global loD = 999 global loS = 999 global MaxMaxS = 0 global MaxMaxD = 0 global MinMinS = 999 global MinMinD = 999 global SQ32 = zeros(Int32,32) global DQ32 = zeros(Int32,32) global Qct = 0 lenAll = length(all) global readings = "" global lineNr = 1 global prevDoy = "" function Doy(doy) if doy == prevDoy return " " end global prevDoy = doy return doy end global TodOy = "" for i = 0 : lenAll - 1 nxt = all[lenAll - i] s = tryparse(Int32, nxt[21:23]) d = tryparse(Int32, nxt[25:26]) ThisDoy = nxt[34:37] if get(EODs,ThisDoy, ITEM("X", "X")) == ITEM("X", "X") EODs[ThisDoy] = [ITEM(s,d)] else push!(EODs[ThisDoy], ITEM(s,d)) end Doy_OUT = Doy(ThisDoy) # + 2022-12-29 07:32 160 60 74 0363= if i < displayCt RT = "" RTX = "" if lineNr == 1 RT = "LINE1" global Todoy = Doy_OUT elseif lineNr == 2 if Doy_OUT != " " RTX = " LINE2" else RT = "LINE2" end end global lineNr = lineNr + 1 global readings *= RTX * (Doy_OUT == " " ? "" : "\n") * " " * nxt[21:32] * " " * nxt[14:18] * " " * (Doy_OUT == " " ? " " : LO_GRAY * Doy_OUT * HI_END) * RT * "\n" if s > hiS global hiS = s end if s < loS global loS = s end if d > hiD global hiD = d end if d < loD global loD = d end end if Qct < 32 global SQ32 = pushDown(s,SQ32) global DQ32 = pushDown(d,DQ32) global Qct += 1 end if Todoy == ThisDoy global ThisDayTotS += s global ThisDayTotD += d global LenThisDay += 1 end end function hilite(nbr, clr) nbrS = string(nbr) return replace(readings, "X" * nbrS => "X" * clr * nbrS * HI_END) end global readings = replace(readings, r"\n ([0-9]{3}) " => s"\nX\1X") function fmtItm(num) a = " " * string(round(num, digits = 1)) lena = length(a) return a[lena - 4: lena] end HI_ = HI_RED LO_ = HI_AQUA global readings = hilite(hiS, HI_) global readings = hilite(hiD, HI_) global readings = hilite(loS, LO_) global readings = hilite(loD, LO_) avgS = formatDecimal(sum(SQ32) / Qct, 2) avgD = formatDecimal(sum(DQ32) / Qct, 2) dd = fmtItm(ThisDayTotS / LenThisDay) * fmtItm(ThisDayTotD / LenThisDay) readings = replace(readings, "LINE1" => " " * dd * " d: " * HI_ * "MAAAS" * " " * "MAAAD" * HI_END * " %%S%% i: " * avgS ) readings = replace(readings, "LINE2" => " " * LO_ * "MINMINS" * " " * "MINMIND" * HI_END * " %%D%% " * avgD * " ( " * formatFixed(string(length(all))) * LO_GRAY * " #:" * string(IgnoredLines) * ". " * formatFixed(stat("w/txts/BP").size) * " v" * version * HI_END * " )") # This was just too goddamned much no-fucking work! shit = Regex("(\\d{4})" * "(\\033\\[0m\\n)" ) readings = replace(readings, shit => s"\1Y\2") x = findall(r"\d{4}Y", readings) global fux = Dict() for itm in x ri = readings[itm] rim = EODs[ri[1:4]] s = 0 d = 0 for itm2 in rim s += itm2.s d += itm2.d end lenRI = length(rim) aaa = string(round(s/lenRI, digits = 1)) * " " * string(round(d/lenRI, digits = 1 )) global fux[ri] = ri[1:4] * " " * aaa end for f in keys(fux) global readings = replace(readings,f => fux[f], count = 1) end #println("\n " * HI_ * string(MaxMaxS) * " " * string(MaxMaxD) * HI_END) #println(" " * LO_ * string(MinMinS) * " " * string(MinMinD) * HI_END * # " (" * string(length(all)) * LO_GRAY * " #" * string(IgnoredLines) * HI_END * ")") EODkeys = [] global data = "" k = [] for kk in keys(EODs) push!(EODkeys, String(kk)) end global prevDT = "" X = sort(EODkeys, rev=true) global Rct = 0 global SR32 = zeros(Float64,32) global DR32 = zeros(Float64,32) #print(replace(readings, r"X([^X]+)X" => s" \1 ")) for itm in X s = 0.0 d = 0.0 for itm2 in EODs[itm] s += itm2.s d += itm2.d end len = length(EODs[itm]) dt = replace(string(Day(tryparse(Int32, itm) - 1) + Date("2023")), "-" => ".") if dt[1:5] == prevDT dt = " " * dt[6:length(dt)] else global prevDT = dt[1:5] end if Rct <32 for itm2 in EODs[itm] if itm2.s > MAAAS global MAAAS = itm2.s end if itm2.s < MINMINS global MINMINS = itm2.s end if itm2.d > MAAAD global MAAAD = itm2.d end if itm2.d < MINMIND global MINMIND = itm2.d end end global SR32 = pushDown(s/len,SR32) global DR32 = pushDown(d/len,DR32) global Rct += 1 end global data *= " " * dt * " " * string(round(s/ len, digits = 1)) * " " * string(round(d / len, digits = 1)) * "\n" end #println("S: ", SR32, "\nD: ", DR32, "\nct: ", Rct) S = formatDecimal(sum(SR32)/ Rct, 2) D = formatDecimal(sum(DR32)/ Rct, 2) for itm in ("MAAAS", "MAAAD" , "MINMINS", "MINMIND") EMP("global readings = replace(readings, \"" * itm * "\" => string(" * itm * "))") end a = open("BP.txt", "w") write(a, data) close(a) #println(" avgS: " , avgS, ". avgD: ", avgD, "'") global readings = replace(readings, "%%S%%" => S) global readings = replace(readings, "%%D%%" => D) print(replace(readings, r"X([^X]+)X" => s" \1 ")) *---- "NUBP" include("WBInclusions") a = open("\\t\\bp", "r") b = readlines(a) close(a) D = Dict() lenB = length(b) for i = 1 : lenB itm = b[lenB + 1 - i] if itm[1:1] == "#" continue end item = split(itm[21:length(itm)], r" +") sp = parse(Int32, item[1]) dp = parse(Int32, item[2]) date = parse(Int32, item[4]) x = get!(D, date, [0, 0, 0]) D[date] = [x[1]+ sp, x[2] + dp, x[3] + 1] end ks = [] for k in keys(D) push!(ks, Int32(k)) end ks = sort(ks) global days = 0 global items = 0 global SumByItemsSP = 0 global SumByItemsDP = 0 global SumByDaysSP = 0 global SumByDaysDP = 0 function h(t) return HI_AQUA * string(t) * HI_END end function hf(t, n) return HI_YELLOW * formatDecimal(t, n) * HI_END end lenKS = length(ks) range = (length(ARGS) > 0 ? parse(Int32, ARGS[1]) : 30) start = ks[lenKS + 1 - range] println("\n NUBP v002. ksLen: ", h(lenKS), ". ksMax: ", h(ks[lenKS]), ". start: ", h(start), " (", h(range), ")\n") for k in ks if k < start continue end dk = D[k] global days += 1 global items += dk[3] global SumByItemsSP += dk[1] global SumByItemsDP += dk[2] global SumByDaysSP += dk[1] / dk[3] global SumByDaysDP += dk[2] / dk[3] end println(" By item: ", hf(SumByItemsSP / items, 3), " ", hf(SumByItemsDP / items, 3), "\n By day: ", hf(SumByDaysSP / days, 3), " ", hf(SumByDaysDP / days, 3)) *---- "del" include("WBInclusions") println(" ") for itm in ARGS try x = findlast("\\", itm) ditm = itm if x != nothing ditm = itm[x.start + 1 : length(itm)] end ditm = "\\deleted\\" * ditm ditmDot = ditm * "." bkupix= 0 while isfile(ditm) ditm = ditmDot * string(bkupix) bkupix += 1 end print(" " * HI_YELLOW * itm * HI_END * " ") cp(itm, ditm) rm(itm) println("deleted." * " Copied to: " * ditm) catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("Initialization failure: ", typeof(ex), ".\n", s); exit(16) end end *---- "WBInclusions" APFSJ = "165" # WBInclusions:APFS # SubstitutionString("s" * "\\1" * t*) using Dates global HI_COLOR_PFX = "\033[" function HI_COLOR(clr) return HI_COLOR_PFX * string(clr) * ";1m" end global LO_GRAY = HI_COLOR(30) global HI_RED = HI_COLOR(31) global HI_GREEN = HI_COLOR(32) global HI_YELLOW = HI_COLOR(33) global HI_BLUE = HI_COLOR(34) global HI_MAGENTA = HI_COLOR(35) global HI_AQUA = HI_COLOR(36) global HI_WHITE = HI_COLOR(37) global HI_END = HI_COLOR_PFX * "0m" function hilite(clr, txt) return clr * string(txt) * HI_END end global UCK = 0 while UCK < 10 try global UTCoffset = Int32(round((Dates.value(now(UTC)) - Dates.value(now())) / (60 * 60 * 1000))) global UCK = 9999 catch ex global UCK += 1 s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n " * hilite(HI_RED * "UTC Failure: " * string(typeof(ex)) * ".") * "\n"); end end global SpellingBees = 102 global HILITE_TOHEX = Dict( 0 => hilite(HI_AQUA, "."), 1 => "1", 2 => "2", 3 => "3", 4 => "4", 5 => "5", 6 => "6", 7 => "7", 8 => "8", 9 => "9", 10 => hilite(HI_AQUA, "A"), 11 => hilite(HI_AQUA, "B"), 12 => hilite(HI_AQUA, "C"), 13 => hilite(HI_AQUA, "D"), 14 => hilite(HI_AQUA, "E"), 15 => hilite(HI_AQUA, "F") ) global TrackedScripts = ["Ascii", "Hexprint", "Sc9", "TzMulti", "BP", "NUBP", "del", "WBInclusions", "WB", "WBafter", "WBupdate", "WBTree", "w/WBCount", "WBSearch", "WBMap", "w/WBcompare", "WBheads", "WBW", "WBX", "WBY", "WBZ", "WB_Transforms", "WBdiff", "ZZ", "WBM", "Quora", "C9images"] function Duree(start, finish, x) # Duree(a, now()) = "0d 00h 35m 56s" a = div(tryparse(Int64,replace(string(finish - start), " milliseconds" => "")), 1000) days = div(a, 86400) rmdr = a - days * 86400 hours = div(rmdr, 3600) mins = div(rmdr - hours * 3600, 60) secs = "00" * string(rmdr - mins * 60) mins = "00" * string(mins) hours = "00" * string(hours) return string(days) * "d " * hours[length(hours) - 1 : length(hours)] * "h " * mins[length(mins) - 1 : length(mins)] * "m " * secs[length(secs) - 1 : length(secs)] * "s" end function Duree(start, finish) return replace(Duree(start, finish, "X"), r"m.*$" => "m") end global APtS_End = DateTime(2022,9,11,15,45) global APtS_ET = "APtS(843) " * Duree(APtS_End, now()) function noww() dt = string(Dates.now()) dtx = findfirst('T', dt) if dtx == nothing || length(dt) < 20 || dt[20] != '.' println("\n**** Date fuckup noww(): \"" * dt * "\" ****\n") exit(16) end return dt[1: dtx - 1] * " " * dt[dtx + 1: 19] end function RRead(nm, options) a = open(nm, "r") b = read(a) close(a) lco = lowercase(options) if lco == "raw" return b end tot127 = 0 first127 = -1 gotDOS = false lowBAD = -1 firstLowBAD = -1 ix = 0 for c in b if c > 127 if first127 == -1 first127 = ix end tot127 += 1 elseif c < 32 if c == 13 # \x0d gotDOS = true elseif c != 10 # not \x0a below \x20 (space char) if firstLowBAD == -1 firstLowBAD = ix end lowBAD += 1 end end ix += 1 end pfx = prefix = "\n\n" if tot127 > 0 println(prefix, hilite(HI_RED, " *** " * string(tot127) * " charcters > 127 found in " * nm * " (" * string(first127) * ") ***")) prefix = "\n" end if lowBAD != -1 println(prefix, hilite(HI_RED, " *** " * string(lowBAD) * " BAD charcters < 32 found in " * nm * " (" * string(firstLowBAD) * ") ***")) prefix = "\n" end if gotDOS println(prefix, hilite(HI_RED, " *** DOS lineend(s) found in: " * nm * " ***")) prefix = "\n" end if pfx != prefix println("\n") end b = String(b) if lco == "asis" return b end if lco == "clean" b = replace(b, "-->" => "``>") return replace(b, r"") end println(" RRead invalid options: \"", options, "\"") exit(16) end function formatDecimal(flt, dgts) a = string(round(flt, digits = dgts)) b = findfirst(r"\.\d+", a) if b == nothing println("\n", hilite(HI_RED, "formatDecimal no period: \"" * string(flt) * "\".")) exit(16) end c = dgts - (b.stop - b.start) if c > 0 a *= "0" ^ c end return a end function formatFixed(fixd) fx = string(fixd) a = "" punctuation = "" while (lenfx = length(fx)) > 3 a = fx[lenfx - 2: lenfx] * punctuation * a punctuation = "," fx = fx[1:lenfx - 3] end if lenfx == 0 return a end return fx * punctuation * a end function getBackupNumber() bkupfn = "/ROM/BO/WBBKUPID" bkupid = open(bkupfn, "r") bkupnr = string(tryparse(Int64, readline(bkupid)) + 1) close(bkupid) bkupid = open(bkupfn, "w") write(bkupid, bkupnr * "\n") close(bkupid) verifi = RRead(bkupfn,"asis") if verifi != bkupnr * "\n" println("\n " * hilite(HI_RED * bkupfn * " update catastrophic failure!") * "\n") exit(16) end return bkupnr end # length(findall(\"info@servantofthepeople.com\", ax) function wh(x) # "X \e[30;1m Y \e[0m Z" = "X " * LO_GRAY * " Y " * HI_END * " Z" return replace(wh(), r"\e\[30;1m([wz])\e\[0m" => s"\1") end function wh() a1 = RRead("Z.txt", "asis") a1 = a1[findfirst("`",a1).start : length(a1)] global confirmeds = length(findall("| ", a1)) global sents = length(findall("|+", a1)) global zelenskys = 0 for itm in ["9", "10", "11", "12"] EMP("ax = RRead(\"Zelensky" * itm * ".html\", \"asis\");" * "ax = ax[findfirst(r\"`[^`]+`\", ax)];" * "global confirmeds += length(findall(\">\", ax));" * "global sents += length(findall(\"THANK YOU FOR YOUR SUBMISSION!\", ax));" * "global zelenskys += length(findall(\"info@servantofthepeople.com\", ax))") end return hilite(LO_GRAY, "w") * string(confirmeds) * "/" * string(sents) * hilite(LO_GRAY, "z") * string(zelenskys) end # Equivalent of APL eval() function EMP(txt) #println("EMP: [", txt, "]") if typeof(txt) != String println("EMP parameter not String: [", txt, "]") return nothing end return(eval(Meta.parse(txt)))::Any end *---- "WB" include("WBInclusions") using WAV include("w/DICT") global JSEARCH = false global STIME = time_ns() APFS = "647" # WB:APFS global versionNr = APFS global NOVERSION = false global FIRST = true global MACROFILE = "MACRODICT" global JULIA_VERSION = string(VERSION) EMP("global dict = " * RRead("MACRODICT", "asis")) global MACRODICT = dict[2] global WithMacros = false function MakeANoise() y, fs = wavread(raw"C:\Windows\Media\Ring01.wav") wavplay(y, fs) end #print("\n WB v" * versionNr * "(" * TVersion * ") (j:" * JULIA_VERSION * "). ") if length(ARGS) == 0 f = open("WB_Transforms", "r") vtn = replace(readline(f), r"[^\"]+\"([^\"]+).*" => s"\1") readline(f) # throwaway for "=>" problem with {{TODAY}} print("\n WB v" * versionNr * "(" * vtn * ") (j:" * JULIA_VERSION * "). Ref.: \"" * hilite(HI_YELLOW, "..\\Template.txt") * "\"\n") ff = filter(x -> findfirst("=>", x) != nothing, readlines(f)) close(f) f = [] HI = HI_AQUA for itm in ff if itm[1:1] == "#" || findfirst("\".html\" => \"\"", itm) != nothing continue end comment = findfirst(r"##[^#]+", itm) comment = comment == nothing ? "" : itm[comment] itm = replace(replace(replace(replace(strip(itm), r"^ *r?\"" => " "), r"\" +=>.*" => ""), r"\\([{}|+.])" => s"\1"), r"[()]" => "") itm = replace(itm, r"{{([^|}]+)" => s"{{YYY\1") itm = replace(itm, "YYY" => HI_YELLOW) itm = replace(replace(replace(itm, "{{" => HI * "{{" * HI_END), r"}}$" => HI* "}}" * HI_END), "|" => HI * "|" * HI_END) itm = replace(itm, HI_AQUA * "|" * HI_END * "BI" * HI_AQUA => HI_RED * "|" * HI_YELLOW * "BI" * HI_AQUA, count = 1) itm = replace(itm, "[\\-+]" => "[-+]") itm = replace(itm, "*}}?" => "*" * HI_AQUA * "}}i" * HI_END * "?") itm = replace(itm, HI_YELLOW * "[Pp]" => "[" * HI_YELLOW * "Pp" * HI_END * "]" * HI_YELLOW) itm = replace(itm, HI_YELLOW * "[Rr]" => "[" * HI_YELLOW * "Rr" * HI_END * "]" * HI_YELLOW) itm = replace(itm, "}}\"i =>" => HI_AQUA * "}}" * HI_YELLOW * "i" * HI_END) itm = replace(itm, "^" * HI_AQUA * "|" * HI_END * "}]+" => "^|}]+") itm = replace(itm, HI_AQUA * "|" * HI_END * "]" => "|]") itm = replace(itm,"WDSG" * HI_AQUA * "|" * HI_END * "Buttocks" * HI_AQUA * "|" * HI_END * "K2" => "WDSG" * HI_RED * "|" * HI_END * "Buttocks" * HI_RED * "|" * HI_END * "K2") itm = replace(itm,"NBB" * HI_AQUA * "|" * HI_END * "ENDNOTE" => "NBB" * HI_RED * "|" * HI_YELLOW * "ENDNOTE" * HI_END) itmOut = itm * replace(comment, r"##( +)" => s"\1# ") if itmOut in f continue end push!(f, itmOut) end f = sort(f) println(" ") for itm in f println(itm) end exit(0) end global ThisFile = ARGS[1] if !endswith(ThisFile, ".html") println(" Not an HTML file: \"", ThisFile, "\"") exit(16) end lx = length(ThisFile) if !isfile(ThisFile) println(" Is not file: \"" * ThisFile * "\"!") exit(16) end include("WB_Transforms") if FIRST print("\n WB v" * versionNr * "(" * TVersion * "). ") global FIRST = false end try gbn = getBackupNumber() global BACKUPFILENAME = "/backups/" * ThisFile * ".qw" * gbn cp(ThisFile, BACKUPFILENAME) println(string(now())[12:19] * " " * hilite(HI_YELLOW, replace(BACKUPFILENAME, "/" => "\\") * " " * ThisFile) * "\n") global DATAIN = RRead(ThisFile, "raw") global FileContents = String(copy(DATAIN)) global LENDIFF = length(DATAIN) - length(FileContents) global OriginalFileContents = FileContents catch ex local s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("Initialization failure: ", typeof(ex), ".\n", s); exit(16) end global Images = findall(r"]+>", FileContents) global iLen = length(Images) for i = 1 : iLen img = Images[iLen + 1 - i] shit = FileContents[img] tgt = findfirst(r" src=\"{{[^}]+}}", shit) if tgt == nothing continue end imgName = shit[tgt] imgNameX = imgName[9 : length(imgName) - 2] dir = getD(imgNameX) if dir == MISSING println("==================> What the GKW1 is: \"" * imgNameX * "\"?\n") continue end global FileContents = replace(FileContents, imgName => " src=\"w/images/" * dir[1] * "/" * dir[2] * "/" * imgNameX) end # href="{{AztecFace.jpg}}" searchString = r" href=\"{{([^}]+)}}" global iLenX = length(findall(searchString, FileContents)) for i = 1 : iLenX local Images = findfirst(searchString, FileContents) if Images == nothing break end img = FileContents[Images] imgNameX = img[10:length(img) - 2] dir = getD(imgNameX) if dir == MISSING println("==================> What the GKW2 is: \"" * imgNameX * "\"?\n") continue end global FileContents = replace(FileContents, img => " href=\"w/images/" * dir[1] * "/" * dir[2] * "/" * imgNameX, count = 1) end if ThisFile == "Zelensky5.html" incs = RRead("Z.txt", "asis") of = FileContents global FileContents = replace(FileContents, r".+?"s => "" * incs * "") if of == FileContents println("\n\n " * hilite(HI_RED, "Zelensky5 no fix") * "\n\n") MakeANoise() end elseif ThisFile == "JustSo.html" incl = RRead("w/txts/VirtualReality.txt", "asis") incs = replace(incl, r"\r?\n" => "
") if length(findall(r"

.+?

"s, FileContents)) != 1 println("\n\n " * HI_RED * "JustSo no fix" * HI_END * "\n\n") MakeANoise() end global FileContents = replace(FileContents, r"

.+?

"s => "

" * incs * "

") end if findfirst("{{", FileContents) != nothing global WithMacros = true for tr in Transforms if (nct = length(findall(tr.first, FileContents))) != 0 ky = string(tr.first) kz = get(MACRODICT, ky, -1) if kz == -1 MACRODICT[ky] = nct else MACRODICT[ky] = min(kz + nct, 9999) end global FileContents = replace(FileContents, tr) end end end if ThisFile == "ChangeLog.html" # ["IndexOfSubjects.html", "ChangeLog.html"] nrFiles = string(length(findall(r")", FileContents))) global FileContents = replace(FileContents, r">Total: [0-9]{1,3}) <" => ">Total: " * nrFiles * ") <", count = 1) elseif ThisFile == "IndexOfSubjects.html" global FileContents = replace(FileContents, r"✔(\(\d+\) )?" => "") local longos = [] local maxlen = 0 # title="Zelensky0">Zelensky0 allAlong = findall(r"
  • [^<>]*]*>\1", FileContents) LallAlong = length(allAlong) allAlongQ = findall("
  • ", FileContents) LallAlongQ = length(allAlongQ) SallAlong = "Σ " * string(LallAlong) * "|" * string(LallAlongQ) global FileContents = replace(FileContents, r"Σ \d{1,3}\|\d{1,3}" => SallAlong) for ix in allAlong itmqqq = FileContents[ix] itm = replace(FileContents[ix], r"^[^=]+=\"([^.]+).*" => s"\1") litm = length(itm) if litm > maxlen longos = [itm] maxlen = litm elseif litm == maxlen push!(longos, itm) end end fc = FileContents for itm in longos global FileContents = replace(FileContents, "
  • "
  • " * "✔(" * string(length(itm)) * ") \(Count: [0-9]+\)\ " => ":darkgreen;\">(Count: " * string(s) * ") ", count = 1) elseif ThisFile == "JSource.html" bkupFile = open("WBBKUP", "w") write(bkupFile,noww() * "\n\n") local len = 0 local blankLines = 0 local chars = 0 for nm in TrackedScripts local b = RRead(nm, "asis") write(bkupFile, "*---- \"" * nm * "\"\n\n") write(bkupFile, b * "\n\n") chars += length(b) if findall(r"[^Rrv]read\(", b) != [] && nm != "WBInclusions" println("read: ", nm) end if JSEARCH z = "RRead(\"IndexOfSubjects" if (zz = length(findall(z, b))) > 0 println(" \"", z , "\" ", nm, " ", zz) end end blankLines += length(findall(r"^[ \r\n]*$"m, b)) l = length(split(b, "\n")) len += l if nm == "WBInclusions" global FileContents = replace(FileContents, r"Included data for other scripts \(\d+\)" => "Included data for other scripts (" * string(l) * ")") end end close(bkupFile) global FileContents = replace(FileContents, r"Sigma; [^<]+" => "Sigma; " * formatFixed(len - blankLines) * "(+" * formatFixed(blankLines) * ") loc. " * formatFixed(chars) * " chars." , count = 1) global FileContents = replace(FileContents, r" id=\"TimeStamp\">[^<]+" => " id=\"TimeStamp\">" * replace(noww()[1:16], "-" => ".") * " (-" * string(UTCoffset) * "h)") global FileContents = replace(FileContents, r"italic;\">J.*?" => "italic;\">J " * JULIA_VERSION * "]") elseif ThisFile == "Scripta.html" global FileContents = replace(FileContents, r"mini bees \+ Genie Bee \+ \d+ " => "mini bees + Genie Bee + " * string(SpellingBees) * " ") elseif ThisFile in ["Zelensky1.html", "Zelensky3.html", "Zelensky4.html", "Zelensky5.html", "Zelensky6.html", "Zelensky7.html", "Zelensky8.html", "Zelensky9.html", "Zelensky10.html", "Zelensky11.html", "Zelensky12.html", "Zelensky13.html"] if ThisFile == "Zelensky5.html" for i = 6 : 13 EMP("readgkw" * string(i) * " = RRead(\"Zelensky" * string(i) * ".html\", \"clean\")") end details = length(findall("|", readgkw6)) - 1 + length(findall("|", readgkw7)) - 1 + length(findall("|", readgkw8)) + length(findall("|", readgkw9)) + length(findall("|", readgkw10)) - 1 + length(findall("|", readgkw11)) + length(findall("|", readgkw12)) + length(findall("|", readgkw13)) + length(findall("|", FileContents)) gkwctLavender = length(findall("lavender", readgkw6)) - 4 + # Remember the asterisks! length(findall("lavender", readgkw7)) + length(findall("lavender", readgkw8)) - 2 + length(findall("lavender", readgkw9)) - 1 + length(findall("lavender", readgkw10)) - 1 + length(findall("lavender", readgkw11)) + length(findall("lavender", readgkw12)) + length(findall("lavender", readgkw13)) + length(findall("lavender", FileContents)) - 1 global NOACK = length(findall("☒", FileContents)) - 1 global ACK = length(findall("☑", FileContents)) - 2 y = string(details) * "r/" * string(gkwctLavender) global FileContents = replace(FileContents, r"  Recents: [^&]+<" => "  Recents: " * wh(0) * "<") global FileContents = replace(FileContents, r"id=\"LAV\" style=\"font-weight:bold;\">[0-9/r]+" => "id=\"LAV\" style=\"font-weight:bold;\">" * y) end Psum = formatFixed(length(findall("Mr. President", FileContents))) Ssum = formatFixed(length(findall(r"Sir[^a-z]", FileContents))) Rsum = formatFixed(length(findall("Putin", FileContents))) Zsum = formatFixed(length(findall(r"(pro\-| )Zelensky", FileContents)) - 2) global FileContents = replace(FileContents, r"Mr\. President: \d+, Sir: \d+\.
    Zelensky: \d+. Putin: \d+" => "Mr. President: " * Psum * ", Sir: " * Ssum * ".
    Zelensky: " * Zsum * ". Putin: " * Rsum, count = 1) if ThisFile == "Zelensky5.html" global FileContents = replace(FileContents, "" => "
          Acknowledged: " * string(ACK - NOACK) * " of " * string(ACK) * ".") end elseif ThisFile == "index1.html" IOS = RRead("IndexOfSubjects.html", "clean") IOSa = findall(r" title=\"([^\"]*)\"[^>]*>\1", IOS) IOSb = [] for i in IOSa ii = IOS[i] ii = replace(ii, r" title=\"([^\"]*)\"[^>]*>\1" => s"\1") if ii in IOSb println("IOSb fuckup: \"", ii, "\"") else push!(IOSb, ii) end end #println(length(IOSb), " ",IOSb) include("V1") VS = [] for k in keys(V[2]) kkk = string(k) kk = kkk[1: length(kkk) - 5] if kk in VS println("VS fuckup: \"", kk, "\"") else push!(VS, kk) end end #println("VS ", VS) println("Len IOSb: ", length(IOSb), ". Len VS: ", length(VS), ". ", "IndexOfSubjects" in IOSb, "|", "IndexOfSubjects" in VS, " - ", "index" in IOSb, "|", "index" in VS) local shit1 = 0 for itm in IOSb shit1 += 1 if !(itm in VS) println("Not in VS: \"", itm, "\"") end end local shit2 = 0 for itm in VS shit2 += 1 if !(itm in IOSb) && itm != "IndexOfSubjects" println("Not in IOSb: \"", itm, "\"") end end if shit1 + 1 == shit2 println(" ") else println("shit1: ", shit1, " shit2: ", shit2) end V1 = open("V1", "r") V1A = readline(V1) local a = findall(r"\d+", V1A) pages = V1A[a[1]] links = V1A[a[2]] if length(links) == 4 # kludge links = links[1:1] * "," * links[2:4] else links = links[1:2] * "," * links[3:5] end close(V1) V2 = open("V2", "r") readline(V2) V2A = readline(V2) a = findfirst(r"\d+", V2A) images = V2A[a] images = images[1:1] * "," * images[2:4] close(V2) fcBefore = FileContents shit = findfirst(r"[^<]+", FileContents) println("-------- ", shit, " \"", FileContents[shit], "\"") global FileContents = replace(FileContents, r"[^<]+" => "" * pages * " pages, " * images * " different images and more than " * links * " hyperlinks", count = 1) shit = findfirst(r"[^<]+", FileContents) println("++++++++ ", shit, " \"", FileContents[shit], "\"") if fcBefore == FileContents println(" ", hilite(HI_RED, "index.html stats not changed"), "\n") end a = Duree(DateTime(2021,9,24,16,00), now()) local b = formatDecimal(tryparse(Int32, a[findfirst(r"\d+", a)])/365.25, 2) global FileContents = replace(FileContents, r"[0-9.]+ years" => "" * b * " years") elseif ThisFile == "Experiment.html" global FileContents = replace(FileContents, r"[^<]+" => "" * noww() * "") end global FileContents = replace(FileContents, r"]+" => ".*?"s => "") global ffff = findfirst(r"[{}]", gggg) if ffff != nothing ffs = ffff.start ffe = ffff.stop ffs = max(0, ffs - 20) ffe = min(length(gggg) , ffe + 30) println("\n\n " * HI_RED * "Stray \"{}\" char(s) in " * ThisFile * HI_END * ": \"" * gggg[ffs:ffe] * "\"\n\n") MakeANoise() end #
    +2022.09.09 v007 # +2022.09.05 v164 # ">+2022.09.10 v016<" " title="Last change: +2022.09.09 v007"" vStamp = findall(r">\+202[0-9]\.[0-1][0-9]\.[0-3][0-9] v[0-9]{3}<", FileContents) VSHIT = findall(r">\+202[0-9]\.[0-1][0-9]\.[0-3][0-9] v[0-9]{3}", FileContents) VSHIT = length(VSHIT) > 0 ? FileContents[VSHIT[length(VSHIT)]][18:33] : "" global wasModified = OriginalFileContents != FileContents if length(vStamp) != 1 println(HI_RED * "Versioning not available for this file: " , string(length(vStamp)) , HI_END * "\n") global NOVERSION = true else if VSHIT != "" println(" " * HI_YELLOW * VSHIT * HI_END) end v = FileContents[vStamp[1]] w = tryparse(Int32, v[15:17]) if w >= 979 println("\n" * HI_RED * "**************** Version number overflow: ", w, " ****************" * HI_END *"\n") MakeANoise() end w = "00000" * string(w + 1) wLen = length(w) w = w[wLen - 2 : wLen] y = string(Dates.now()) z = ">+" * y[1:4] * "." * y[6:7] * "." * y[9:10] * " v" * w * "<" q = FileContents global FileContents = replace(FileContents, v => z, count = 1) if FileContents != q print(" Versionstamp updated to: " * HI_YELLOW * z[2:length(z) - 1] * HI_END * ".") needExtraLineEnd = true q = FileContents for tr in [ r"[“”]" => "\"", r"[‘’]" => "'", Char(0x2010) => "-", # Hyphen Char(0x2011) => "-", # Non-breaking hyphen Char(0x2026) => "...", # Elipsis " " => " ", # Preverted space r"[–—]" => "–", # Perverted hyphen "→" => "→", # " " => " ", # Wierd space in times n?n:***[AP]M ] global FileContents = replace(FileContents, tr) end if FileContents != q println(" Non-Ascii characters replaced.\n") needExtraLineEnd = false end q = FileContents global FileContents = replace(FileContents, r"(pax in terris|Dona nobis pacem) \| ([^<]+)" => s"Nullius in verba | \2", count = 1) if FileContents != q println(" Title updated.\n") needExtraLineEnd = false end q = FileContents global FileContents = replace(FileContents, "

    " => "

    ") if FileContents != q println(" ", Int32((length(q) - length(FileContents)) / 28), " Hdrs updated.\n") needExtraLineEnd = false end if needExtraLineEnd println("\n") end q = FileContents if findfirst("" => "\n", count = 1) end if FileContents != q println(" Author added.\n") end q = FileContents replace(FileContents, "\r\n" => "\n") if FileContents != q println(" DOS linend(s) fixed.\n") end q = FileContents replace(FileContents, "\r" => "") if FileContents != q println(" Stubborn DOS linend(s) fixed.\n") end else println(" Version not updated!\n") end end if ThisFile == "Quora12.html" Qfn = "Q.txt" if isfile(Qfn) QBACKUPFILENAME = "/backups/" * Qfn * ".qw" * getBackupNumber() cp(Qfn, QBACKUPFILENAME) q = FileContents local newQtext = replace(replace(RRead(Qfn,"asis"), "\r\n" => "\n"), r"^[\n ]*" => "") newQtext = replace(newQtext, r" *\n+ *"m => "

    \n\n

    ") newQtext = "

    " * "{{TODAY}}. " * newQtext global FileContents = replace(FileContents, r"Begin entries \*\*\*\*\*\*\*\* --> *\n+"m => "Begin entries ******** -->\n\n" * newQtext * "

    \n\n") if FileContents == q println(ThisFile * " add data failed") else while findfirst("

    ", newQtext) != nothing newQtext = replace(newQtext, r"[ \n]*

    " => "") end println(ThisFile * " added data: ", length(q), " => ", length(FileContents)) rm(Qfn) end else println(ThisFile * " no \"" * Qfn * "\" file, No new data"); end q = FileContents global FileContents = replace(FileContents, r"Len: [\d,]+  \d+\." => "Len: " * formatFixed(length(FileContents)) * "  " * string(length(findall("¶", FileContents))) * ".") if q == FileContents println(HI_YELLOW, ThisFile * " length not updated" , HI_END , "\n") end elseif ThisFile == "TheSocietyOfTheUnheard.html" q = FileContents local TZM = RRead("TZMulti", "asis") for itm in [["&", "&"], ["<", "<"], [">", ">"]] TZM = replace(TZM, itm[1] => itm[2]) end TZPLACEHOLDER = "{{TZMDATA}}" global FileContents = replace(FileContents, r"(.|\n)+?" => "\n" * TZPLACEHOLDER * "\n\n") if FileContents == q println(HI_RED, " ---- TheSocietyOfThe Unheard update failed (1) ----", HI TZM) if FileContents == q println(" ++++ TheSocietyOfThe Unheard not updated ++++\n") elseif findfirst(TZPLACEHOLDER, FileContents) != nothing println(HI_RED, " ---- TheSocietyOfThe Unheard update failed (2) ----", HI s" \1", count = 1) rslt = " " * akk * ". Processed: " * HI_YELLOW * ThisFile * HI_END * ". " * (wasModified ? HI_YELLOW * "*Txt-" * HI_END * "Modified" : "Txt-Unmodified") * ", " * (x ? HI_YELLOW * "*Dt-Un" * HI_END * "changed." : "Dt-Changed.") * " (" * formatFixed(length(FileContents)) * (LENDIFF == 0 ? "" : ", " * string(LENDIFF)) * ") " * replace(string((time_ns() - STIME) / 1000000000), r"\.(\d{4}).*" => s".\1") println(replace(rslt, "Txt-Unmodified, Dt-Changed" => HI_AQUA * "OK normal result" * HI_END, count = 1)) FNX = "WBCTR" a = open(FNX, "r") b = readlines(a)[1] close(a) c = "00000000" *string(tryparse(Int32,b[1:7]) + 1) lenC = length(c) d = "00000000" *string(tryparse(Int32,b[9:14]) + NOVERSION) c = c[length(c) - 6 : length(c)] * " " * d[length(d) - 5 : length(d)] a = open(FNX, "w") write(a, c * " " * b[16:length(b)] * "\n") close(a) a = open("WBAuditTrail", "a") b = string(Dates.now()) write(a, c * " " * b[1:10] * " " * b[12:19] * " " * ThisFile * "\n") close(a) catch ex local s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n Vaidation failure]: ", typeof(ex), ".\n", s); exit(16) end # println(replace(string(MACRODICT), r"(, |Int32}\()" => "\n")) # println(replace(replace(replace(replace(string(MACRODICT), r"(, |Int32}\()" => "\n"), r"(r\\|\\\")" => ""), "\\ =" => " ="),r" (\d+)\)" => s" \1")) # println(replace(replace(replace(replace(replace(c, "\\\\|" => " | "), r"({{|}})" => s" "), "=>" => ""), r"\| [^ ]+" => ""), r" ([^ ]+) +(\d+)" => s" \2 \1")) # sort(split(replace(d * " ", "\n" => " \n"), "\n"), rev = true) d1 = dict[1][1] + 1 d2 = dict[1][2] + (length(ARGS) > 1 ? 1 : 0) d3 = dict[1][3] + (WithMacros ? 1 : 0) d0 = open(MACROFILE, "w") write(d0, replace(replace(string([[d1, d2, d3], MACRODICT]), ", \"" => ",\n\""), "}(\"r" => "}(\n\"r")) close(d0) *---- "WBafter" #using Pkg; Pkg.add("HTTP") include("WBInclusions") include("w/DICT") APFS = "120" # WBafter:APFS # Get images! global k = keys(D) global IMGarry = [] for ky in k x = D[ky] y = "w/images/" * x[1] * "/" * x[2] * "/" * ky z = string(Dates.unix2datetime(mtime(y))) push!(IMGarry, z[1:10] * " " * z[12:16] * " " * hilite(LO_GRAY, "w/images/") * x[1] * "/" * x[2] * "/" * ky) end global incoming = Dict{String, Array{String}}() nowww = noww() global arry = [] global ctr = 24 global ctrTrick = "" if length(ARGS) > 0 x = tryparse(Int32, ARGS[1]) if x != nothing && x > 0 global ctr = x else global ctrTrick = "!" end end global xtras = [ "w/WBKountout.html", "z.txt", "w/css/WBmiracle.css", # "V2", # "V1", ] global xtras = vcat(xtras, TrackedScripts) global xcludeds = [ "JUNK.html", "JUNK2.html", "JUNK6.html", "JUNK7.html", "JUNK10.html", "XXXTree.html", "XXXXTree.html", "XXXRTree.html" ] try global errId = 1 a = readdir() for itm in a if findfirst(".html", itm) == nothing || itm in xcludeds continue end t0 = string(Dates.unix2datetime(mtime(itm))) push!(arry, t0[1:10] * " " * t0[12:16] * " " * itm) end for itm in xtras tx = string(Dates.unix2datetime(mtime(itm))) push!(arry, tx[1:10] * " " * tx[12:16] * " " * itm) end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s); exit(16) end yxxx = tryparse(Int32, nowww[12:13]) + UTCoffset fudge = yxxx > 23 ? " **" : "" xxx = "00" * string(yxxx) xxx = xxx[length(xxx) - 1: length(xxx)] pct = formatDecimal(Dates.value(now() - APtS_End) / (86400 * 10 * 843), 2) * "%" println("\n WBafter v" * APFS * " " * hilite(HI_YELLOW, nowww[1:10] * " " * xxx * nowww[14:16] * " UTC" * fudge) * "(" * string(UTCoffset) * "h)" * ctrTrick * " " * hilite(LO_GRAY, string(ctr)) * " " * replace(replace(APtS_ET, r"d(.*)" => s"dZZZ\1"), "ZZZ" => LO_GRAY) * HI_END * " (" * pct * ")") # On +2024.01.23 I was so discouraged/depressed that I gave up on this but next morning # I saw how to do it and going carefully step by step, did it. Easily. No screaming. n = string(now()) savemeDir = "/SAVEME" Files = readdir(savemeDir) times = [] for itm in Files if !startswith(itm, r"BO|ROM|bradstuff") continue end push!(times,mtime(savemeDir * "/" * itm)) end sortedTimes = sort(times) sLen = length(sortedTimes) howLongAgo = Duree(Dates.unix2datetime(sortedTimes[sLen]), Dates.now(UTC)) println(" " * n[1:10] * " " * n[12:16] * " Bkup: " * hilite(HI_YELLOW, "-" * howLongAgo) * " Z: " * hilite(HI_YELLOW, string(Date(now())-Date(2022,2,23))[1:3]) * " days. " * wh()) # Check backup files for scripts global wbFirst = true for d in ["./", "./w/"] cd(d) a = readdir("./") for itm in a if !endswith(itm, "1") || !isfile(itm) || itm in ["DICT1", "V1", "V2", "SZ1"] continue end if RRead(itm, "raw") == RRead(itm[1:length(itm) - 1], "raw") continue end println((wbFirst ? "\n" : "") * " WB not match: \"" * itm * "\"") global wbFirst = false end end cd("../") #if RRead("WBBKUP", "raw") != RRead("WBBKUP1", "raw") # println((wbFirst ? "\n" : "") * " WB not match: \"WBBKUP\"") # global wbFirst = false #end println(" ") global ydm = "xxxxxxxxxx" b = open("WBLOG-TS", "r") c = readline(b) close(b) push!(arry,c[1:16] * " " * hilite(HI_AQUA, "~-------")) println(" " * hilite(LO_GRAY, formatFixed(length(arry)) * " " * formatFixed(length(IMGarry))) * hilite(HI_YELLOW, " V1, V2" * " " ^ 22) * hilite(LO_GRAY, "j:" * string(VERSION))) z = sort(vcat(arry, IMGarry), rev=true) for i = 1 : min(ctr,length(z)) zi = z[i] if zi[1:10] == ydm println(" " * zi[11:length(zi)]) continue end global ydm = zi[1:10] println(" " *zi) end #close(y) *---- "WBupdate" include("WBInclusions") APFS = "012" # WBupdate:APFS global version = APFS nowww = noww() inf = "\n" * "WBupdate(" * version *"). " * HI_AQUA * nowww * HI_END * " (local time) " * APtS_ET * "\n" w = open("WBLOG-TS", "w") yxxx = tryparse(Int32, nowww[12:13]) + UTCoffset xxx = "00" * string(yxxx) xxx = xxx[length(xxx) - 1: length(xxx)] write(w, nowww[1:10] * " " * xxx * nowww[14:16] * "\n") close(w) #close(write(open("WBLOG-TS", "w"), nowww[1:10] * " " * nowww[12:16])) # Does not work print(inf) nowww = string(Dates.now()) nowww = nowww[1:10] * " " * nowww[12:16] yyxxx = tryparse(Int32, nowww[12:13]) + UTCoffset fudge = yyxxx > 23 ? " **" : "" xxx = "00" * string(yyxxx) xxx = xxx[length(xxx) - 1: length(xxx)] println(" " * nowww[1:10] * " " * xxx * nowww[14:16] * " UTC") if yxxx > 23 run(`"\windows\System32\notepad.exe" WBLOG-TS`) end *---- "WBTree" include("WBInclusions") global SHOWUNUSEDS = false APFS = "258" # WBTree:APFS version = APFS mutable struct R ct::Int32 nm::String end global V1ID = getBackupNumber() global SOUGHT = 0 global QUORAS = 0 global nowww = noww() global DATEPROBLEMS = [] global Validated = -1 global SZ = 0 global EXTERNAL_LINKS = 0 global TOTAL_LINKS = 0 global IMAGE_LINKS = 0 global EMPTIES = 0 global totAUI = 0 global YAHOOS = 0 global ZAHOOS = 0 global szDict = Dict{String,Array{String}}() global oflDict = Dict{String, Int32}() global ILUsage = Dict{String, Int32}() global ILUct = 0 global ILUIgnoreds = Dict{String, Array{String}}( "_LynxBlk" => [], "_Footnotes" => [], "_BRM5V" => [] ) global NUTHIN = ["NUTHIN"] function ILU(itm) a = get!(ILUsage, itm, -1) if a == -1 if itm == "IndexOfSubjects#X" && findfirst(" id=\"X\"", RRead("IndexOfSubjects.html", "clean")) != nothing return end println(hilite(HI_YELLOW, " Not found: \"" * itm * "\"")) return end ILUsage[itm] = a + 1 poundStart = findfirst("#", itm).start id = itm[poundStart + 1: length(itm)] f = itm[1:poundStart - 1] if haskey(ILUIgnoreds,id) aa = ILUIgnoreds[id] if !(f in aa) push!(aa, f) end end end global IDS = Dict{String,Array{String}}() global LWIDS = Dict() global MAPS = 0 global L2C1FirstPadding = true global noTOCs = [] global FootnoteBlocks = 0 global HRlen = 24 global HighRevisions = [] for i = 1 : HRlen push!(HighRevisions, R(-1 * i, "")) end global SumRevisions = 0 global NYTComments = 1 # Add one for th comment I had to take direcly from the NYT website +2023.06.01 global Bingers = 0 global Googlers = 0 global Qsum = 0 global Q = "" global AllFilesInCurrentDirectory = [] function qwrite(txt) global Qsum += length(txt) global Q *= txt end function ErrorQuit(txt) println(hilite(HI_RED, "\n--------\n " * txt * "\n--------") * "\n") exit(16) end HSYMS = [] global fdict = Dict{String, String}() global ildict = Dict{String, Int64}() global linkCt = 0 global ilinkCt = 0 global pageCt = 0 global incoming = Dict{String, Array{String}}() global externalLinks = Dict{String, Array{String}}() global excludeds = ["IndexOfSubjects.html"] global ignoreds = [ "JUNK.html", "JUNK2.html", "JUNK6.html", "JUNK7.html", "JUNK10.html" ] pre = "\n\n\n\nLink inventory\n\n\n\n
    \"Previous\"Welcome
    \n
    \n" * "

    WBTree v" * version * ".        Index   Images   Dashboard\"Next2a.gif\"        " * APtS_ET * "
    \n" pres = Dict( "Tree" => "Go: RTree\"Next2a.gif\"\"Next2a.gif\"", "RTree" => "Go: XTree\"Next2a.gif\"\"Next2a.gif\"", "XTree" => "Go: Tree\"Next2a.gif\"\"Next2a.gif\"" ) pre2 = "

    \n" post = "\n

    [ Ω W3C HTML validator  ~--S,Z-- ]

    \n" println("\nWBTree v", version, " (./V1). ", nowww, " " * APtS_ET , ". V1ID: " * hilite(HI_YELLOW, string(V1ID)) * "\n") rm("XXXTree.html", force=true) rm("XXXRTree.html", force=true) rm("XXXXTree.html", force=true) function saveTable(fn, fv) global Q = "" global Qsum = 0 qwrite(pre) qwrite(pres[fn]) qwrite(pre2) qwrite(replace(fv, r"TheActiFist (<=|=>)" => s"TheActiFist \1  Damn him (her, other)!")) qwrite(post) # sQsum = string(Qsum) sQsum = formatFixed(Qsum) # sQsum[1:3] * "," * sQsum[4:6] ilc = "" if fn == "Tree" ilc = "  " * formatFixed(length(findall(" href=\"#",Q))) end global Q = replace(Q, "--S,Z--" => sQsum * ilc, count = 1) global q = open("XXX" * fn * ".html", "w") write(q, Q) close(q) end function makeTable(DICT, ptr) global L2C1FirstPadding = true if ptr == "=>" istr = string(ilinkCt) if ilinkCt > 999 listr = length(istr) istr = istr[1: listr - 3] * "," * istr[listr - 2: listr] end global out = "\n" global ILINKS = istr global RLINKS = lc elseif ptr == "<=" global out = "
    T Pages: " * string(pageCt) * ". Interpage links > " * lc * ". Imaps: " * string(MAPS) * ". NYTs: " * string(NYTComments) * ". B/G: " * string(Bingers) * "/" * string(Googlers) * "
    " * nowww * ". Intrapage ('#') links > " * istr * ". Img links: " * formatFixed(IMAGE_LINKS) * ". Footnotes: " * string(FootnoteBlocks) * ".
    \n" else global out = "
    R Reverse table of incoming internal interpage links:
    " * nowww * "
    \n" end global shit = [] global shit = collect(keys(DICT)) global shoot = copy(shit) ghosts = [] crt = 0 shitx = sort(shit, by=lowercase) for s in shitx s2 = s[1:(length(s) - 5)] if length(DICT[s]) == 0 push!(ghosts, (s2 == "IntoTheLight" ? "IntoTheLight" : "" * s2 * "")) end ilss = "" ils = get(ildict, s, 0) if ils > 0 ilss = "(DDD" * string(ils) * ")" end if ptr != "<<=" if s2 == "welcome" s2a = "" else s2a = "|" * s2 end ohmygod = "" * s2 * "" if s2 == "IntoTheLight" ohmygod = "IntotheLight" end global out *= "" else if s2 == "https://validator.w3" global Validated = length(findall(",", DICT[s])) + 1 DICT[s] = "[ TMTC: " * string(Validated) * " ]" end crtx = string(crt += 1) sFixed = replace(s, "&" => "!!!") sFixed = replace(sFixed, r"(!!!|&)" => "&") if s != sFixed println("\n \"", s, "\"\n \"", sFixed, "\"\n") end crtx = (" " ^ (4 - length(crtx))) * crtx global out *= "" end if s2 in ["OnCitation", "Date", "BRADFORD", "EndOfEarth"] && ptr == "<=" global out *= "" if s2 == "Date" #ds = replace(DICT[s], r"\1" => s"\1.html") ds = replace(DICT[s], r"([^\"]+)" => s"\1.html") global DS = split(ds, ", ") global DICK = Dict() for shooter in shoot DICK[shooter] = 0 end for ddss in DS DICK[ddss] = 1 end k = keys(DICK) for kk in k if DICK[kk] == 0 push!(DATEPROBLEMS, kk[1:length(kk) - 5]) end end global DATEPROBLEMS = sort(DATEPROBLEMS) end elseif s2 != "welcome" || ptr != "<=" global out *= "\n" else losers = "" snoTOCs = sort(noTOCs) for item in snoTOCs loser = item[1:length(item) - 5] if loser == "welcome" continue end losers *= "" * loser * ", " end global out *= "\n" end global L2C1FirstPadding = false end gh = replace(replace(replace(string(ghosts), "\\\"" => "SHIT"), "\"" => "\""), "SHIT" => "\"") out *= (length(ghosts) == 0 ? "" : "") out = replace(out, "!QWERTY!" => string(crt), count=1) return(out) end # Shrink code by translating all internal links into 2 character codenames, so "#BRADFORD" might become "#bO" # This will break at 2705 files Alphas = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] global Translates = Dict{String,String}() global trix = 0 function setID(fn) if length(fn) == 1 Translates[fn] = fn return end ch1 = div(trix,52) ch2 = trix - ch1 * 52 Translates[fn] = Alphas[ch1 + 1] * Alphas[ch2 + 1] global trix += 1 end try global errId = 1 THEGODDAMNEDDIR = readdir() for itm in THEGODDAMNEDDIR if findfirst(".html", itm) == nothing || itm in ignoreds continue end incoming[itm] = [] itmX = itm[1 : length(itm) - 5] setID(itmX) push!(AllFilesInCurrentDirectory, itmX) end zz = replace(RRead("IndexOfSubjects.html", "clean"), r"✔(\(\d+\) )?" => "") z = findall(r"
  • ]", zz) global FilesInIndexOfSubjects = [] for itm in z shitstain = replace(zz[itm], r"
  • ]" => s"\1,\2") shitstain = replace(shitstain, " " => "_") shitcomma = findfirst(",", shitstain).start firstshit = shitstain[1:shitcomma - 1] lastshit = shitstain[shitcomma + 1 : length(shitstain)] if firstshit != lastshit println("\n", hilite(HI_RED, " Mismatched entry in IndexOfSubjects \"" * firstshit * "\" \"" * lastshit * "\""), "\n") exit(16) end if firstshit in FilesInIndexOfSubjects println("Duplicate in IndexOfSubjects: \"", shitstain, "\"") exit(16) end push!(FilesInIndexOfSubjects,firstshit) end for itm in AllFilesInCurrentDirectory if !(itm in FilesInIndexOfSubjects) println("** In AllFilesInCurrentDirectory but not in FilesInIndexOfSubjects: " , itm) end end for itm in FilesInIndexOfSubjects if !(itm in AllFilesInCurrentDirectory) println("** In FilesInIndexOfSubjects but not in In AllFilesInCurrentDirectory: " , itm) end end global ALLUNUSEDIDS = Dict{String,Array{String}}() global ORIGINALUNUSEDIDS = Dict{String,Array{String}}() rr = 0 for f in FilesInIndexOfSubjects ftext = RRead(f * ".html", "clean") if length(findall(r"[{}]", replace(ftext, r".*?"s => ""))) != 0 println("\n\n " * hilite(HI_RED, "Stray \"{}\" characters in " * f * ".html.") * "\n\n") end ff = findall(r" id=\"[^\"]+", ftext) rr += length(ff) for fff in ff t = ftext[fff.start+5:fff.stop] ILUsage[f * "#" * t] = 0 abitch = get!(ALLUNUSEDIDS, f, ["MISSING"]) bbitch = get!(ORIGINALUNUSEDIDS, f, ["MISSING"]) if abitch != bbitch println("ADDSADSADSADSADSADA") exit(16) end if abitch == ["MISSING"] ALLUNUSEDIDS[f] = [t] ORIGINALUNUSEDIDS[f] = [t] continue end push!(abitch, t) push!(bbitch, t) end end global errId = 2 vTable = [] for itm in keys(incoming) global pageCt += 1 item = itm global errId = 4 sres = RRead(item, "clean") global errId = 5 global SZ += length(sres) x = findfirst("href=\"welcome.html#TOC\"", sres) if x == nothing push!(noTOCs,item) end ofl = findfirst(r"", sres) if ofl != nothing oflDict[item] = tryparse(Int32, sres[ofl][10:12]) end global EXTERNAL_LINKS += length(findall(r"", sres)) fns = length(findall(r"Footnotes()+", sres)) if fns > 0 if fns > 1 println("\n", hilite(HI_RED, "Footnote problem in " * item), "\n") exit(16) end global FootnoteBlocks += 1 end global NYTComments += length(findall("Your comment has been approved!", sres)) global Bingers += length(findall("This page indexed on Bing", sres)) global Googlers += length(findall("This page indexed on Google", sres)) if startswith(itm, "Quora") aa = r"\d{3}  ([\d,]+)\." global QUORAS += tryparse(Int32, replace(sres[findfirst(aa,sres)],aa => s"\1")) end # " +2022.04.30 v002 " yyyyyy = findall(r">\+[0-9][0-9][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9] v[0-9][0-9][0-9]", sres) yLen = length(yyyyyy) if yLen != 1 && !(item == "Experiment.html" && yLen == 3) # KLUDGE ErrorQuit("Versioning wrong in file: " * item) end # Police department if length(findall(r"({{|}})", sres)) != 0 ErrorQuit("Loose bracket(s): " * item) end if length(findall("size:larger;\"> = HighRevisions[i].ct if i == HRlen HighRevisions[HRlen] = R(rv,item) break end nh = [] if i > 1 nh = HighRevisions[1:i - 1] end global HighRevisions = append!(nh, [R(rv,item)], HighRevisions[i:HRlen - 1]) break end end x = findall(r"href=\"[a-zA-Z0-9-_!]+\.html#[^\"]+", sres) y = [] for z in x w = sres[z] v = findfirst("#", w) push!(y, [w[7 : v.start - 6], w[v.start + 1 : length(w)]]) global ILUct += 1 ilu = w[7 : v.start - 6] * "#" * w[v.start + 1 : length(w)] ILU(ilu) goddamnedfilename = w[7 : v.start - 6] if goddamnedfilename == "IndexOfSubjects" continue end goddamnedlink = w[v.start + 1 : length(w)] ids = ALLUNUSEDIDS[goddamnedfilename] if goddamnedlink in ids kky = findall(x->x == goddamnedlink, ids) if length(kky) > 1 println("\n", hilite(HI_RED, " Duplicate \"id\" name? \"" * item * "\" \"" * goddamnedfilename * "\"\n " * sring(kky) * " \"" * goddamnedlink, "\""), "\n") exit(16) end if length(kky) == 1 deleteat!(ids, kky) end end end yahoo = [] xhoo = findall(r" href=\"#[^\"]+", sres) global YAHOOS += length(xhoo) for zhoo in xhoo w = sres[zhoo] ww = w[9 : length(w)] global ILUct += 1 ilu = item[1:length(item) - 5] * "#" * ww ILU(ilu) ids = ALLUNUSEDIDS[item[1: length(item) - 5]] if ww in ids kky = findall(x->x == ww, ids) if length(kky) > 1 println("Duplicate item in ALLUNUSEDIDS: " * item * " \"" * ww * "\"") exit(16) end if length(kky) == 1 deleteat!(ids, kky) if length(findall(x->x == ww, ids)) != 0 println("Deleteat failed for: " * item * " \"" * ww * "\"") exit(16) end end end push!(yahoo, ww) end zahoo = [] xhoo = findall(r" id=\"[^\"]+", sres) global ZAHOOS += length(xhoo) for zhoo in xhoo w = sres[zhoo] push!(zahoo, w[6 : length(w)]) end for src in yahoo if !(src in zahoo) println(" " * item * " internal link src missing target: \"" * src * "\"") end end ittm = itm[1 : length(itm) - 5] LWIDS[ittm] = y x = findall(r" id=\"[^\"]+", sres) y = [] for z in x push!(y, sres[z.start + 5 : z.stop]) end IDS[ittm] = y x = findall(r"&#[^;]+;", sres) for y in x z = sres[y] if z in HSYMS continue end push!(HSYMS, z) end if itm in excludeds global fdict[itm] = "[ Everything ]" continue end if findfirst(r"aplacetostudy"i, sres) != nothing println((item in ["Dashboard.html", "JSource.html"] ? "" : "** ") * "\"Aplacetostudy\": " * item) end global MAPS += length(findall("" * x * "" end global fdict[itm] = str global ildict[itm] = iq = length(findall(r" "", count=1) t = t[1:length(t) - 1] if get(externalLinks, t, "!") == "!" externalLinks[t] = [itm] else if !(itm in externalLinks[t]) push!(externalLinks[t], itm) end end end end vTable = sort(vTable) global vDict = "global V = [\"" * replace(string(Dates.now()), r"T(.{8}).*" => s" \1") * " " * V1ID * "\", Dict{String,String}(\n" for item in vTable a = findfirst(" ", item) #vText *= item[a.start + 1:length(item)] * " " * item[1 : a.start - 1] * "\n" dictName = item[1 : a.start - 1] dictValue = item[a.start + 1:length(item)] global vDict *= " \"" * dictName * "\" => \"" * dictValue * "\",\n" ofl = get!(oflDict, dictName, 0) dictValue = "0000000" * string(tryparse(Int32,dictValue) + 1000 * ofl) dictValue = dictValue[length(dictValue) - 4:length(dictValue)] dv = get!(szDict, dictValue, ["NOTHING"]) if dv == ["NOTHING"] szDict[dictValue] = [dictName] else szDict[dictValue] = append!(szDict[dictValue], [dictName]) end end shitshit = sort(collect(keys(szDict)), rev=true) hiVersions = "" for i = 1 : 12 s = shitshit[i] hiVersions *= " " * s * " " * replace(string(szDict[s]), r"([\[\]\"]|\.html)" => "") * "\n" end szFile = open("HIversions.txt", "w") write(szFile, hiVersions) close(szFile) catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end ErrorQuit("\n Failure[" * string(errId) * "]: " * string(typeof(ex)) * ".\n" * s); end lc = string(linkCt) if linkCt > 999 lenlc = length(lc) lc = lc[1:lenlc - 3] * "," * lc[lenlc - 2:lenlc] end global incoming2 = Dict{String, String}() for k in keys(incoming) ary = incoming[k] str = "" for x in sort(ary, by=lowercase) stp = x[1:length(x)-5] str *= (str != "" ? ", " : "") * "" * stp * "" end global incoming2[k] = str end T = makeTable(fdict, "=>") RT = makeTable(incoming2, "<=") global incoming2 = Dict{String, String}() for k in keys(externalLinks) if findfirst("https://faculty.washington.edu/walter/Killing%20Cats3.html#_edn", k) != nothing continue end ary = externalLinks[k] str = "" for x in sort(ary, by=lowercase) stp = x[1:length(x)-5] stp2 = "" if stp != "welcome" stp2 = "|" * stp end str *= (str != "" ? ", " : "") * "" * stp * "" # ZZZZZ end global incoming2[k] = str end XT = makeTable(incoming2, "<<=") XT = replace(XT, "!VICTORY!" => string(Validated), count=1) saveTable("Tree", T) saveTable("RTree", RT) saveTable("XTree", XT) println("\n--------\n") global ct = 0 global chksL = 0 global chksR = 0 shitx = sort(collect(keys(LWIDS))) for k in shitx for kk in LWIDS[k] if kk[1]== "" # local links in same file global chksL += 1 if kk[2] in IDS[k] continue end spacer = "" if length(k) < 12 spacer = " " ^ (12 - length(k)) end println(k, spacer, " ? \"#" * kk[2] * "\"") global ct += 1 continue end global chksR += 1 if kk[2] in IDS[kk[1]] continue end spacer = "" if length(k) < 12 spacer = " " ^ (12 - length(k)) end println(k, spacer, " ? \"" * kk[1] * "#" * kk[2] * "\"") global ct += 1 end end global tks = 0 global uks = 0 global uksTotal = 0 global kyy = [] for ky in keys(ALLUNUSEDIDS) push!(kyy, string(ky)) end for ky in sort(kyy) # keys(ALLUNUSEDIDS) global tks += length(ORIGINALUNUSEDIDS[ky]) global uks += length(ALLUNUSEDIDS[ky]) global uksTotal += length(ALLUNUSEDIDS[ky]) for ignore in keys(ILUIgnoreds) if ignore in ALLUNUSEDIDS[ky] global uks -= 1 end end aui = [] for itm in ALLUNUSEDIDS[ky] if !(startswith(itm, "cite") || itm in keys(ILUIgnoreds)) push!(aui, itm) end end lenaui = length(aui) if lenaui > 0 global totAUI += lenaui #---------------- if SHOWUNUSEDS println("** " , length(aui), " ", ky, " ", sort(aui)) end #---------------- end end global usedMulti = 0 global usedOnce = 0 global multis = 0 global keyCount = 0 global kk = 0 #global kkk = [] global II = 0 for k in keys(ILUsage) global keyCount += 1 ii = ILUsage[k] if ii == 0 kkkk = findfirst("#", k) kkkk = k[kkkk.start+1: length(k)] if kkkk in keys(ILUIgnoreds) global II += 1 end elseif ii == 1 global usedOnce += 1; else global usedMulti += 1 global multis += ii - 1 global kk += 1 iii = " " ^ (6 - length(string(ii))) * string(ii) #push!(kkk, iii * " " * string(k)) end end #kkk = sort(kkk, rev=true) #for j in kkk # println(j) #end function X(position, data) x = data - tryparse(Int32,xdata[position]) if x != 0 XS[position] = "[" * string(x) * "]" global xdata[position] = string(data) global changed = true end end global xdata = split(RRead("TreeData", "asis"), "\n") global XS = [] for i = 1 : length(xdata) push!(XS, "") end global changed = false; X(1,TOTAL_LINKS - EXTERNAL_LINKS) X(2,EXTERNAL_LINKS) X(3, NYTComments) if changed xfile = open("TreeData", "w") write(xfile, xdata[1] * "\n" * xdata[2] * "\n" * xdata[3]) close(xfile) end iDups = (tks - uksTotal) - ilinkCt q1 = Duree(DateTime(2023,8,1,16,00), now()) q2 = formatDecimal(QUORAS / (tryparse(Int32, q1[findfirst(r"\d+", q1)]) + 1), 4) * "0000" q3 = hilite(HI_YELLOW, replace(q2, r"^(\d+\.\d).*" => s"\1")) * replace(q2, r"^\d+\.\d(\d).*" => s"\1") println("\n Links: ", hilite(HI_YELLOW, formatFixed(TOTAL_LINKS - EXTERNAL_LINKS)), XS[1], "i + ", hilite( HI_YELLOW, formatFixed(EXTERNAL_LINKS)), XS[2], "r. ", formatFixed(SZ), ". Empties: ", hilite(HI_YELLOW, formatFixed(EMPTIES)), ". Quoras: ", formatFixed(QUORAS), " (" * q3 * "). Orphan IDs: ", formatFixed(totAUI)) global HR1s = [] global a = open("JUNK5.txt", "w") write(a, " " * "+" * replace(replace(noww(), "-" => "."), " " => "+")[1:16] * ". WBTree\n\n") for i = 1 : HRlen i1 = HighRevisions[i].ct if i < 7 push!(HR1s,i1) end i1 = string(i1) pfx = " " ^ (8 - length(i1)) write(a, pfx * i1 * " " * HighRevisions[i].nm * "\n") end close(a) hrs = string(HR1s) println("\n Errs:", (ct == 1 ? "" : HI_YELLOW), ct, (ct == 1 ? "" : HI_END), ". NYTs: ", hilite(HI_YELLOW, NYTComments), XS[3], ". B/G: ", hilite(HI_YELLOW, Bingers), "/", hilite(HI_YELLOW, Googlers), ". Revs: " * hilite(HI_GREEN, replace(hrs[5:length(hrs) - 1], "," => "")) * " (" * hilite(HI_GREEN, formatFixed(string(SumRevisions))) * ") " * hilite(HI_AQUA, " ** Good to go! **")) sdp = string(DATEPROBLEMS) sdp = sdp[4 : length(sdp)] println("\n",length(DICK), "-", length(DS), "=", length(DATEPROBLEMS), ". DateProblems ", # . ?: ",length(shoot), " ", sdp) #string(DATEPROBLEMS) #println("\n YAHOOS: " , YAHOOS, ". ZAHOOS: " , ZAHOOS, ".") vFile = open("V1", "w") write(vFile, "# " * string(pageCt - 1) * " " * # Don't count IndexOfSubjects string(linkCt + EXTERNAL_LINKS + IMAGE_LINKS) * " sum(map((x) -> tryparse(Int32,string(x)), values(V[2])))\n" * vDict * ")]\n") close(vFile) #println("\nSOUGHT: " , SOUGHT) *---- "w/WBCount" include("../WBInclusions") APFS = "186" # WBCount:APFS version = APFS global D = "D = Dict{String, Array{Any}}( # God damn strong typing! [string, string, int?]\n" pre = "\n\n\n\nImage inventory\n\n\n\n\n
    \n" post = "\n

    XXXX

    \n

    XYXY

    \n

    [ Ω W3C HTML validator ]

    \n" global unhex = Dict{String,Int32}( "0" => 0, "1" => 1, "2" => 2, "3" => 3, "4" => 4, "5" => 5, "6" => 6, "7" => 7, "8" => 8, "9" => 9, "a" => 10, "b" => 11, "c" => 12, "d" => 13, "e" => 14, "f" => 15 ) global uppers = Dict{String,Int32}( "0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "a" => 0, "b" => 0, "c" => 0, "d" => 0, "e" => 0, "f" => 0 ) global lowers = Dict{String,Int32}( "0" => 0, "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "a" => 0, "b" => 0, "c" => 0, "d" => 0, "e" => 0, "f" => 0 ) global ignoreds = [ "JUNK.html", "JUNK2.html" ] global DISTR = Dict(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0, 13 => 0, 14 => 0, 15 => 0 ) global D10Plus = 0 global distr = [] for i = 1:256 push!(distr,0) end global tbl = Dict() global maxLen = -1 global ct = 0 global rejects = [] global dshit = [] global FirstImage = true global REPO = length(ARGS) > 0 && lowercase(ARGS[1]) == "repo" global TrivialImages = ["Next2a.gif", "Prev2a.gif", "Spacer.gif", "WikiMedia.png"] global trivials = 0 global Qsum = 0 global Q = "" global Biggies = [] global TOTSZ = Int64(0) function qwrite(txt) global Qsum += length(txt) #write(q, txt) global Q *= txt end for (root, dirs, files) in walkdir(".") #println("Directories in $root") #for dir in dirs # println(joinpath(root, dir)) # path to directories #end #println("Files in $root") for file in files x = joinpath(root, file) # path to files #if !contains(x, "images") if findfirst(r"^\.\\images\\([0-9a-f])\\\1[0-9a-f][\\]", x) == nothing if findfirst(r"^\.\\(css\\|txts\\|pdfs\\)", x) == nothing push!(rejects, x) end continue end # Create a directory with copies of all the image files if REPO tgt = "\\REPO\\" * x[15 : length(x)] try rs = open(tgt, "w") write(rs, RRead(x, "raw")) close(rs) catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n REPO: ", tgt , ": ", typeof(ex), ".\n", s); end end y = length(x) z = x[15:y] zLen = length(z) if zLen > maxLen global maxLen = zLen end global tbl[z] = replace(x[1:14], r"[\\]" => "/") global ct += 1 if !(tbl[z] in dshit) push!(dshit, tbl[z]) end end end dt = string(Dates.now()) dtx = findfirst('T', dt) dtx = replace(dt[1: dtx - 1] * " " * dt[dtx + 1: length(dt)], r"\.[0-9]+" => "", count=1) global stuff = "

    [WBCount v" * version * "]  " * pwd() * "   (--IMAGES--)  --S,Z--.
    maxLen: " * string(maxLen) * ", count: " * string(ct) * ".  " * dtx * ".      Links   Dashboard\"Next2a.gif\"
    " global stuff *= ""Hey, don't it always seem to go, that you don't know what you've got 'till it's gone...." (Joni Mitchell; how many pictures I have lost by failing to capture them when I saw them!)

    " fuck = sort(collect(keys(tbl)), by=lowercase) global stuff *= "\n
  • X !QWERTY! outgoing external links (several uninteresting items excluded):
    " * nowww * "  (Validator: !VICTORY!)
    " * ohmygod * " " * ptr * "
    " * crtx * ". " * sFixed * "" * ilss * " " * ptr * "
    [ TMTC: " * string(1 + length(findall(",", DICT[s]))) * " ]
    " * (ptr == "<=" && s2 == "IntoTheLight" ? "[ All incoming links remote ==> ]" : (length(DICT[s]) > 0 ? DICT[s] : " ")) * "
    !TOC[" * losers[1 : length(losers) - 2] * "]
    Ghosts: " * gh * "
    " * "" for ks in fuck ww = tbl[ks] uppers[ww[12:12]] += 1 lowers[ww[13:13]] += 1 w = unhex[ww[12:12]] * 16 + unhex[ww[13:13]] + 1 distr[w] += 1 # # global stuff *= "" * tbl[ks][10:13] * "\n" global FirstImage = false # println(tbl[ks], " ",ks) global D *= " \"" * ks * "\" => [\"" * tbl[ks][10:10] * "\", \"" * tbl[ks][12:13] * "\"],\n" end for r in rejects if r in [".\\WBCount", ".\\WBCount1", ".\\WBKountOut.html", ".\\WBcompare", ".\\WBcompare1"] continue end println(" ", r) end println("\n-------") global ImageCache = Dict{String, Int32}() global ict = 0 global failures = [] cd("../") # This shit makes no sense to me, so I cheated. GODDAMNED RIGHT! try for (root, dirs, files) in walkdir("./w/") for file in files x = joinpath(root, file) # path to files if !contains(x, "images") continue end z = replace(x, "\\" => "/") global ImageCache[z[3 : length(z)]] = 0 sz = " " * string(stat("/ROM/BO/" * z).size) sizesz = length(sz) push!(Biggies, sz[sizesz - 7:sizesz] * " " * z[17:length(z)]) global ict += 1 end end global errId = 1 a = readdir() global errId = 2 for itm in a if findfirst(".html", itm) == nothing || itm in ignoreds continue end global item = itm global errId = 4 txt = RRead(item, "clean") txt = replace(txt, r"url\('?([^')]+)'?\)" => s" src=\"\1\" ") # kludge up backgraound images images = findall(r" (src|href)=\"[^\"]+", txt) for i = 1 : length(images) str0 = txt[images[i]] if !contains(str0, "/w/images/") if length(str0) >= 10 && str0[1:10] == " href=\"w/i" str0 = replace(str0, " href=\"" => " href=\"./", count = 1) elseif length(str0) >= 9 && str0[1:9] == " src=\"w/i" str0 = replace(str0, " src=\"" => " src=\"./", count = 1) else continue end end str1 = replace(str0, "%27" => "'") off = findfirst("\"", str0) str = str1[(off[1] + 3):length(str1)] if haskey(ImageCache, str) global ImageCache[str] += 1 elseif !isfile(str) strd = "./" * str[1:13] if !isdir(strd) mkdir(strd) println(" ", strd) end println("?MISSING: ", str) else println("?GODKNOWSWHAT: ", str) end end end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n Failure: ", typeof(ex), ".\n", s); #exit(16) push!(failures, item) return 0 end global unused = "" global unusedPfx = "" global Uct = 0 ks = keys(ImageCache) global ReverseImages = Dict{Int32, Array{String}}() global bigsum = 0 global ones = 0 for k in ks global TOTSZ += stat(k).size if ImageCache[k] == 0 global unused *= unusedPfx * "\"" * k * "\"" global unusedPfx = ", " global Uct += 1 else kn = ImageCache[k] kkX = k[15:length(k)] if k[15:length(k)] in TrivialImages global trivials += ImageCache[k] end global stuff = replace(stuff, "--" * kkX * "--" => string(kn), count=1) global bigsum += kn if kn == 1 global ones += 1 end if !(kkX in ["Prev2a.gif", "Next2a.gif", "Spacer.gif", "HTML5V.png", "GarbageCan.gif", "K2.gif", "Buttocks.jpg", "United_states.gif", "WDSG.gif"]) if haskey(ReverseImages, kn) push!(ReverseImages[kn], kkX) # ReverseImages[kn] *= ", " * "\"" * kkX * "\"" else global ReverseImages[kn] = [kkX] # "\"" * kkX * "\"" end end end end global tot = 0 print("\nuppers: ") for z in ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"] global tot += uppers[z] print(" " * string(uppers[z])) if z in ["7", "f"] print(" " * HI_YELLOW * string(tot) * HI_END * " ") global tot = 0 end end println("\n") global tot = 0 print("lowers: ") for z in ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"] global tot += lowers[z] print(" " * string(lowers[z])) if z in ["7", "f"] print(" " * HI_YELLOW * string(tot) * HI_END * " ") global tot = 0 end end println("\n") print("Going to save ./WBKountOut.html : (" * pwd() * ")\n") #global q = open("w/WBKountOut.html", "w") # qwrite(pre) sbs = formatFixed(bigsum) consequentials = formatFixed(bigsum - trivials) stuff = replace(stuff, "--IMAGES--" => "Celibates: " * string(ones)) stuff = replace(stuff, r"" => "") qt = stuff * "
    " * "" * "QQsbsQQ" * "
    " * ks * "--" * ks * "--
    --[^>]+**
    " * "" * formatFixed(length(ImageCache)) * "  Σ+ " * sbs * "
    " fuckedup = replace(qt, "QQsbsQQ" => formatFixed(length(ImageCache) - length(TrivialImages)) * "  Σ- " * consequentials, count = 1) qwrite(fuckedup) shitx = sort(collect(keys(ReverseImages)), rev=true) global nuthin = "[nuthin]" println(" ") for i = 1 : length(shitx) sq = shitx[i] if sq < 12 # min usage count for celebities list continue end z = "" zzz = sort(ReverseImages[sq]) for zz in zzz # ReverseImages[sq] if length(z) > 0 z *= ", " end z *= "\"" * zz * "\"" end s = string(sq) u = "(" * string(length(ReverseImages[sq])) * ") " println(" " ^ (6 - length(s)) * s, " ", u[1:6], z) global nuthin = "" end if length(unused) > 0 print("\n Unused: " * unused * " (" * string(Uct) * ")\n\n") qwrite("

    " * replace(replace(unused, "w/images/" => ""), " " => "  ") * "

    ") end qwrite(post) #global q = open("w/WBKountOut.html", "w") Q = replace(Q, "NancyTheBitch.jpg
    " => "NancyTheBitch.jpg (~Melva)", count=1) Q = replace(Q, "FirstSteps.jpg" => "FirstSteps.jpg (Modified)", count=1) Q = replace(Q, "Giphy.gif" => "Giphy.gif (Animated)", count=1) sQsum = formatFixed(Qsum) STOTSZ = formatFixed(TOTSZ) #write(q, replace(Q, "--S,Z--" => "DDD" * sQsum * " " * STOTSZ * "", count = 1)) #close(q) println("\n./WBKountOut.html saved: " * sQsum * " " * APtS_ET) if nuthin != "" println(" " * nuthin) end global shi = [] for s = 1:20 append!(shi,0) end global crap = "" global crap_HTML = "" for i = 1 : length(distr) if i % 32 == 1 global crap *= " " global crap_HTML *= " " if i % 64 == 1 global crap *= "\n " global crap_HTML *= "
    " end end distri = distr[i] global shi[distri + 1] += 1 global crap *= HILITE_TOHEX[distri] if distri > 9 global D10Plus += 1 end DISTR[distri] += 1 if distri == 0 global crap_HTML *= "." elseif distri < 10 global crap_HTML *= string(distri) else global crap_HTML *= "" * "ABCDEF"[distri-9:distri-9] * "" end end global crap_HTML *= "  " * string(D10Plus) global mulch = 0 for i = 1: length(shi) global mulch += (i - 1) * shi[i] if shi[i] != 0 global shi[i] = [i - 1, shi[i], mulch] end end for i = 1 : length(shi) if shi[length(shi)] != 0 break end global shi = copy(shi)[1:length(shi) - 1] end global shidt = 0 global shid = [] for i = 2 : length(shi) if shi[i] == 0 append!(shid, 0) continue end sh = shi[i][2] # * (i - 1) append!(shid, sh) # - shi[i - 1][3]) global shidt += sh end tots = [] for itm in shi push!(tots, itm[3]) end #SHID = open("w/SHID", "w") #write(SHID, "global SHID = " * string(tots)) #close(SHID) global shidd = [] global dnom = shi[length(shi)][3] for i = 1 : length(shi) push!(shidd, replace(string((shi[i][3]/dnom) * 100 + 0.005) * "0000", r"\.([0-9]{2})[0-9]+" => s".\1") * "%") end println(crap * " " * string(D10Plus) , "\n\n", shi, " ", shidt, "\n\n", replace(string(shidd), "\"" => ""), " " * string(length(shidd) - 1)) global distrBars = "" for i = 0 : 12 si = " " * string(i) lensi = length(si) si = replace(si[lensi - 2 : lensi], " " => " ") global distrBars *= si * " " * ("*" ^ DISTR[i]) * "
    " end Q = replace(Q, "XXXX" => crap_HTML) Q = replace(Q, "XYXY" => distrBars) q = open("w/WBKountOut.html", "w") write(q, replace(Q, "--S,Z--" => "" * sQsum * "  " * STOTSZ * "", count = 1)) close(q) global D *= ")\n\nglobal DICT_VERSION = \"WBCount v" * version * " (D:001).\"\n\n" global D *= "global MISSING = [\"MISSING_1\", \"MISSING_2\"]\n\n" global D *= "function pushD(ky, itm)\n" global D *= " r = get!(D, ky, MISSING)\n" global D *= " if r == MISSING\n" global D *= " return(r)\n" global D *= " end\n" global D *= " return(push!(r, itm))\n" global D *= "end\n\n" global D *= "function appendD(ky, itm...)\n" global D *= " r = get!(D, ky, MISSING)\n" global D *= " if r == MISSING\n" global D *= " return(r)\n" global D *= " end\n" global D *= " return(append!(r, itm...))\n" global D *= "end\n\n" global D *= "function getD(ky, ksub)\n" global D *= " a = get!(D, ky, MISSING)\n" global D *= " if a == MISSING\n" global D *= " return(MISSING)\n" global D *= " end\n" global D *= " if ksub > length(a) || ksub < 1\n" global D *= " return(MISSING)\n" global D *= " end\n" global D *= " return a[ksub]\n" global D *= "end\n\n" global D *= "function getD(ky)\n" global D *= " return(get!(D, ky, MISSING))\n" global D *= "end\n\n" global D *= "global DCOLOR1 = HI_RED * \"****** \"\n" global D *= "global DCOLOR2 = HI_END\n" global D *= "function addD(ky, val)\n" global D *= " if typeof(val) != Vector{String} || length(val) != 2 || typeof(val[1]) != String ||\n" global D *= " typeof(val[2]) != String\n" global D *= " throw(ArgumentError(DCOLOR1 * \"Bad argument: \" * string(val) * DCOLOR2))\n" global D *= " end\n" global D *= " if typeof(ky) != String\n" global D *= " throw(ArgumentError(DCOLOR1 * \"Bad key: \" * string(ky) * DCOLOR2))\n" global D *= " end\n" global D *= " if getD(ky) != MISSING\n" global D *= " throw(ArgumentError(DCOLOR1 * \"Exists: \" * string(ky) * DCOLOR2))\n" global D *= " end\n" global D *= " D[ky] = val\n" global D *= " return(D[ky])\n" global D *= "end\n" d = pwd() * "\\w\\DICT" a = open(d, "w") write(a, D) close(a) a = open("w/BIG", "w") b = sort(Biggies, rev=true)[1:24] for c in b write(a, c * "\n") end close(a) *---- "WBSearch" include("WBInclusions") APFS = "209" # WBSearch:APFS version = APFS global PRE = 20 global POST = 38 global FILTER = nothing global FILTERED = false global MATCHES = [] global PUTS = "" global ARGZ = copy(ARGS) global ARGZlen = length(ARGZ) if ARGZlen > 0 && ARGZ[1][1:1] == "#" len = length(ARGZ[1]) EMP("global FILTER = " * RRead(ARGZ[1][2:len], "asis")) global ARGZ = ARGZlen == 1 ? [] : ARGZ[2:ARGZlen] global FILTERED = true global ARGZlen -= 1 end if ARGZlen == 0 println("\n WBSearch [ \"%%x%\" for 1:'^', 2:'>', 3:'&', 4:'|' ] v" * APFS * "\n\n RegEx_string [before(", PRE, ") after(", POST, ")] [case-sensitive?]") exit(0) end for itm in ["%%1%" => "^", "%%2%" => ">", "%%3%" => "&", "%%4%" => "|"] ARGZ[1] = replace(ARGZ[1], itm) end if length(ARGZ) > 2 global PRE = parse(Int32, ARGZ[2]) global POST = parse(Int32, ARGZ[3]) end global WC = Dict{String, Int32}() global WCequals = Dict{String, Int32}() global WCcount = 0 global WChcount = 0 global C9s = [] global C9imageDict = Dict{String, Any}() global nowww = noww() # if (h >= "Α" && h <= "Ω") || (h >= "α" && h <= "ω") # Don't trust Greeks! global excludeds = ["Α", "Β", "Γ", "Δ", "Ε", "Ζ", "Η", "Θ", "Ι", "Κ", "Λ", "Μ", "Ν", "Ξ", "Ο", "Π", "Ρ", "΢", "Σ", "Τ", "Υ", "Φ", "Χ", "Ψ", "Ω", "α", "β", "γ", "δ", "ε", "ζ", "η", "θ", "ι", "κ", "λ", "μ", "ν", "ξ", "ο", "π", "ρ", "ς", "σ", "τ", "υ", "φ", "χ", "ψ", "ω", " ", "!", """, "#", "'", "(", ")", "*", "-", "/", ":", "<", "=", ">", "Y", "[", "]", "e", "h", "j", "n", "r", "{", "|", "}"] global t = time(); global gotsomething = false global SZ = Dict{String, String}() global HSYMS = [] global HSYMCT = 0 global WorkString = "" global CCT = 1 global MAXL = 0 global AgeDistribution = Dict{String, Int32}() #global isWIN = Sys.iswindows() #if isWIN # pwwd = pwd() # pwws = findlast("\\", pwwd) # global SOSOSO = pwwd[pwws.start + 1:length(pwwd)] * "\\" #else global SOSOSO = "" #end function et() return formatDecimal(time() - t, 3) end OUTPUTFILE = "JUNK.html" #isWIN ? pwd() * "\\..\\JUNK.html" : "JUNK.html" OUTPUTFILE2 = "JUNK2.html" #isWIN ? pwd() * "\\..\\JUNK2.html" : "JUNK2.html" OUTPUTFILE7 = "JUNK7.html" #isWIN ? pwd() * "\\..\\JUNK7.html" : "JUNK7.html" global searchString = ARGZ[1] global ACCUMS = zeros(Int32, 1) global searchString = ARGZlen == 2 || ARGZlen == 4 ? Regex(searchString) : Regex(searchString, "i") global strs = open("JUNK3.txt", "a") write(strs, nowww * " " * string(searchString) * "\n") close(strs) global errId = 0 global ctr = 0 global cctr = 0 global out = "\n" try global errId = 1 if FILTER == nothing global FILTER = readdir() end global errId = 2 for itm in FILTER itmLen = length(itm) if !isfile(itm) || itmLen < 6 || itm[itmLen - 4 : itmLen] != ".html" || itm in ["XXXRTree.html", "XXXXTree.html" , "XXXTree.html", "JUNK.html", "JUNK2.html", "JUNK6.html", "JUNK7.html", "JUNK10.html"] continue end global item = itm global errId = 4 res = RRead(item, "asis") lenRes = length(res) if lenRes > 49999 lenRes = " " * string(lenRes) lenLenRes = length(lenRes) chk = lenRes[lenLenRes - 10 : lenLenRes] if get(SZ, chk, "GKW") != "GKW" println("Error: " * chk * " " * item) # Program breaks if 2 files same len exit(16) end SZ[chk] = item end c9s = findall(r" href=\"c9/[^\"]+\"", res) for c9 in c9s push!(C9s, [res[c9], item]) end c9s = findall(r" (src|href)=\"c9/[^\"]+\"", res) for c9 in c9s rr = res[c9] if !contains(rr, ".html") r = replace(replace(rr, r" (src|href)=\"c9/" => ""), "\"" => "") a = get(C9imageDict, r, "NUTHIN") if a == "NUTHIN" C9imageDict[r] = Dict{String, Int32}(item => 1) else aa = get(a, item, "NUTHIN") if aa == "NUTHIN" a[item] = 1 else a[item] = a[item] + 1 end end end end WC0 = findall(r"[ \n][a-zA-Z-]+", res) for wc in WC0 s = lowercase(res[wc]) sstop = wc.stop s = s[2 : length(s)] rs1 = res[sstop + 1: sstop + 1] if rs1 == "=" || (rs1 == ":" && s in ["background-color", "border", "border-collapse", "border-radius", "color", "direction", "font-family","font-size", "font-weight", "height", "line-height", "margin", "padding", "text-align", "text-decoration", "vertical-align", "white-space", "width"]) global WChcount += 1 s *= rs1 a = get(WCequals, s, 0) WCequals[s] = a + 1 else global WCcount += 1 a = get(WC, s, 0) WC[s] = a + 1 end end global ctr += 1 if ctr % 50 == 0 ctrr = " " * string(ctr) lenCtrr = length(ctrr) println(ctrr[lenCtrr - 4 : lenCtrr] , " " , et()) end txt = res # String(res) # global zzzzzz = txt # " +2022.04.30 v002 " yyyyyy = findall(r">\+[0-9][0-9][0-9][0-9]\.[0-9][0-9]\.[0-9][0-9] v[0-9][0-9][0-9]", txt) if length(yyyyyy) != 1 && !(item == "Experiment.html" && length(yyyyyy) == 3) # KLUDGE println("Versioning wrong in file: " * item) exit(16) end age = txt[yyyyyy[1]][3:11] if age[9:9] == "3" # Merge dom 30, 31 into 20's age = age[1:8] * "2" end if get(AgeDistribution, age, "NO") != "NO" AgeDistribution[age] += 1 else AgeDistribution[age] = 1 end x = findall(r"&#[^;]+;", txt) global HSYMCT += length(x) for y in x z = txt[y] if length(y) > 10 println(" MESS in ", itm , ": ", hilite(HI_RED, "STARTMESS"), "\"", z , "\"", hilite(HI_RED, "ENDMESS"), "\n") end if z in HSYMS continue end push!(HSYMS, z) end global cctr += length(txt) quotes = "" ct = 1 s = searchString qqk = findall(s, txt) qq = length(qqk) for itm in qqk alpha = itm.start - PRE omega = itm.stop + POST if alpha < 1 omega -= alpha - 1 alpha = 1 end if omega > length(txt) omega = length(txt) end bailout = false global tq = txt[alpha:omega] for i = 1 : length(tq) global ii = Int32(Char(tq[i])) if ii > 127 println("Fuckup: " , item , " \"", tq, "\" " , ii, " \"" , tq[i] , "\"") bailout = true tq = "?" * replace(tq, r"[;&<>']" => "?") * "?" break end end if !bailout aaw = findfirst(s, tq) tq = tq[1 : aaw.start - 1] * "WQWQWQ" * tq[aaw.start : aaw.stop] * "XQXQXQ" * tq[aaw.stop + 1: length(tq)] tq = replace(tq, ";" => "!!!!!!!!#59;") tq = replace(tq, "&" => "&") tq = replace(tq, "!!!!!!!!" => "&") tq = replace(tq, "<" => "<") tq = replace(tq, ">" => ">") tq = replace(tq, "\"" => """) tq = replace(tq, "'" => "'") tq = replace(tq, "/" => "/") tq = replace(tq, "{" => "{") tq = replace(tq, "}" => "}") tq = replace(tq, " " => " ") tq = replace(tq, "WQWQWQ" => "", count=1) # Underscore the search text! tq = replace(tq, "XQXQXQ" => "", count=1) end inf = "
    " * string(ct) * ". " * string(itm) global shitfuckshit = 22 if length(inf) > 21 println("\n Inf problem in ", item, ": " * string(length(inf)) * " \"" * inf * "\"\n") global shitfuckshit = 24 end quotes *= inf * (" " ^ (shitfuckshit - length(inf))) * "" * tq * "" ct += 1 end global ACCUMS += [qq] if quotes != "" L = length(item) - 5 if L > MAXL global MAXL = L end global WorkString *= (WorkString == "" ? "" : ", ") * item[1:L] push!(MATCHES, item) global PUTS *= "put " * item * "\n" global out *= "\n" * string(CCT) * ". " * item[1:length(item) - 5] * "  " * quotes * "\n" global out = replace(out, "OSOSOS" => SOSOSO) global gotsomething = true global CCT += 1 end end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\nDoing: " * item * " \"" * tq * "\"") println(" Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s); exit(16) end hsyms = [] hsyms2 = [] global k = 1 global gotSomething = false for i = 1 : length(HSYMS) h = HSYMS[i] if h in excludeds # Don't trust Greeks! continue end if k % 10 == 1 if gotSomething kn1 = k - 1 sp = "[" * string(kn1) * "]" push!(hsyms, sp) sp = "[" * string(kn1) * "]" push!(hsyms2, sp) gotSomething = false end end push!(hsyms, h) push!(hsyms2,h[3 : length(h) - 1]) global k += 1 global gotSomething = true end sct = formatFixed(HSYMCT) global out *= (gotsomething ? "" : "\n[No matches]  \n") * "

     

    \n" * "

    " * string(k - 1) * ":  " * replace(join(hsyms, ", "), ", [" => " [") * "


    " * "

    " * string(k - 1) * ":  " * replace(replace(join(hsyms2, ", "), ", [" => " ["), "x" => "x") * "  [Σ " * sct * "]

    \n" * "JUNK2.html  JUNK3.txt  JUNK7.html" * "

    PUTS | MATCHES  (" * string(MAXL) * ") \"" * WorkString * "\"



    \n
    \"This
    " stotlen = string(cctr) if cctr> 999 stotlen = stotlen[1:length(stotlen) - 3] * "," * stotlen[length(stotlen) - 2 : length(stotlen)] end if cctr > 999999 stotlen = stotlen[1:length(stotlen) - 7] * "," * stotlen[length(stotlen) - 6 : length(stotlen)] end pre = "\nFrustra\n

    " s = Array{Any}(undef, 1 * 2 + 1) s[1] = " " global ix = 2 println(" searchString: ", hilite(HI_AQUA, "| "), searchString , hilite(HI_AQUA, " |"), ".") ss = searchString s[ix] = ss global ix = ix + 1 s[ix] = " " global ix += 1 s = replace(replace(string(s), "<" => "<"), ">" => ">") sp = "" s = replace(s, "Any[" => "Any[ ") s = replace(s, "\" \", " => "  ") s = replace(s, ", \" \"" => "   ") s = replace(s, "Any[   r\"" => "Any[   r\"" * sp) s = replace(s, "\"i,   r\"" => "\"i,   r\"" * sp) s = replace(s, r"\"(i?)   " => s"\"\1   ") pre *= "[ \"%%x%\" for 1:'^', 2:'>', 3:'&', 4:'|' ]  " * s * ".  " * OUTPUTFILE pre *= "
    Files: " * string(ctr) * ".  Chars: " * stotlen * ".  Σ" * string(ACCUMS) * string(CCT - 1) * "  Time: " * et() * ".  v" * version * "      " * replace(APtS_ET, r"d([^m]+)m" => s"d\1s") * (FILTERED ? "    FILTERED!" : "") * "

    " z = open(OUTPUTFILE, "w") write(z, pre * out) close(z) kk = keys(SZ) szfuxk = [] for k in kk push!(szfuxk, string(k)) end global fu = "" szfuxk = sort(szfuxk, rev = true) global fx = " 3" global FU66 = " " for f in szfuxk if f[6:6] != FU66 # fx[6:6] != " " && f[6:6] == " " global fu *= "\n" global fx = " " * f[6:6] global FU66 = f[6:6] end global fu *= f * " " * SZ[f] * "\n" end fuLen = length(szfuxk) kk = keys(AgeDistribution) szfuxk = [] for k in kk push!(szfuxk, string(k)) end szfuxk = sort(szfuxk, rev = true) global pf1 = "" global pf2 = "" global you = "" global totAges = 0 for f in szfuxk ct = " " * string(AgeDistribution[f]) global totAges += AgeDistribution[f] lenCt = length(ct) newf = "" if f[1:4] == pf1 newf = " " else global pf1 = f[1:4] newf = pf1 end newf *= " " if f[6:7] == pf2 newf *= " " else global pf2 = f[6:7] newf *= pf2 end newf *= " " * f[9:9] shitshit = ct[lenCt - 5 : lenCt] global you *= "\n " * newf * shitshit end global totAgess = " " * string(totAges) global lenTA = length(totAgess) global you *= "\n ----------\n " * totAgess[lenTA - 5 : lenTA] z = open(OUTPUTFILE2, "w") write(z, "\n\n\nFrustra\n") write(z,"\n") write(z,"\n\n
    \n

    C:\\ROM\\JUNK2.html

    \n
    \n")
    zn = string(now())
    zn = zn[1:10] * " " * zn[12 : length(zn)] 
    write(z, "    WBSearch v" * version * "(j:" * string(VERSION) * ")   [ \"%%x%\" for 1:'^', 2:'>', 3:'&', 4:'|' ]   " * APtS_ET * "\n")
    fu2 = replace(fu, r" ([0-9]+)   ([^ .]+)\.html" =>
                      s" \1   \2.html")
    
    fu2 = replace(fu2, "OSOSOS" => SOSOSO)
    write(z, "    " * zn * "  (" * string(fuLen) * "\n" * fu2)
    write(z, you)
    write(z, "
    \n
    \n") write(z, "\n" ) global tr = "" C9ss = sort(C9s, by = x -> lowercase(x[1] * x[2])) FU = Dict() for c9 in C9ss if get!(FU, c9, "SHIT") == "SHIT" FU[c9] = 1 else FU[c9] += 1 end end SHIT = [] for k in keys(FU) push!(SHIT, string(k)) end ASSHOLE0 = [] for shit in keys(FU) push!(ASSHOLE0, [shit[2] * shit[1], [shit[1], shit[2], FU[shit]]]) end ASSHOLE = sort(ASSHOLE0, by = x -> lowercase(x[1])) global tr = "c9/" global ix = 0 for shit0 in ASSHOLE shit = shit0[2] write(z, "" * shit[2] * "" * tr * "" * shit[1][11 : length(shit[1]) - 1] * "" * string(shit[3]) * "\n") global tr = " " global ix += 1 end write(z, "\n") write(z, "
    \"This
    \n
    \n") close(z) println("\nOutput saved to: " * OUTPUTFILE* ". Σ" * string(ACCUMS) * string(CCT - 1) * "\nv" * version * ". Time: " * et()) function gsk(x) x2 = x[2] lenx2 = length(x2) if (lenx2 = length(x2)) > 3 return x[1] * 276922881 + # powers of 129 Int32(x2[1]) * 2146689 + Int32(x2[2]) * 16641 + Int32(x2[3]) * 129 + Int32(x2[4]) end if lenx2 == 3 return x[1] * 276922881 + Int32(x2[1]) * 2146689 + Int32(x2[2]) * 16641 + Int32(x2[3]) * 129 end if lenx2 == 2 return x[1] * 276922881 + Int32(x2[1]) * 2146689 + Int32(x2[2]) * 16641 end return x[1] * 276922881 + Int32(x2[1]) * 2146689 end function WCf(dict) WCS = [] for k in keys(dict) v = dict[k] push!(WCS, [v,string(k)]) end return sort(WCS, by = x -> gsk(x), rev=true) end global info = replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(string(WCf(WC)), r"Any\[(\d+). \"([^\"]+)\"\][,\]] ?" => s"\n\1 \2"), r"^Any\[" => ""), r"\n(\d{4}) " => s"\n \1 "), r"\n(\d{3}) " => s"\n \1 "), r"\n(\d{2}) " => s"\n \1 "), r"\n(\d) " => s"\n \1 ", count = 1), r"\n (\d{4}) " => s"\n \n \1 ", count=1), r"\n (\d{3}) " => s"\n \n \1 ", count=1), r"\n (\d{2}) " => s"\n \n \1 ", count=1), r"\n (\d) " => s"\n \n \1 ", count=1), r"\n(\d) " => s"\n \1 ") # I do not understand why I need this translation global info *= "

    Equals and colons (" * formatFixed(length(WCequals)) * "):

    \n
    \n"
    
    global brk = 77
    global frst = true
    WCSS = WCf(WCequals)
    vlen = length(WCSS)
    for i = 1 : vlen
        v = WCSS[i]
        v1 = string(v[1])
        lenv = length(v1)
        if lenv != brk
            if !frst
                global info *= " \n"
            end
            global frst = false
            global brk = lenv
        end
        global info *= " " ^ (5 - lenv) * v1 * "  " *  v[2]  * "\n"
    end
    
    z = open(OUTPUTFILE7, "w")
    write(z, "\n\n\nFrustra\n\n
    \n

    C:\\ROM\\JUNK7.html    X3  X2  X1 EC\"Next\"

    \n

    " * noww() * "  v" * APFS * ".    Unique words: " * formatFixed(length(WC)) * ".   Total words:  Text: " * formatFixed(WCcount) * ",  HTML: " * formatFixed(WChcount) * "

    \n
    \n")
    zn = string(now())
    zn = zn[1:10] * " " * zn[12 : length(zn)] 
    write(z, "WBSearch v" * version * "(j:" * string(VERSION) * ")   [ \"%%x%\" for 1:'^', 2:'>', 3:'&' ]   " * APtS_ET * "\n")
    fu2 = replace(fu, r" ([0-9]+)   ([^ .]+)\.html" =>
                      s" \1   \2.html")
    write(z, info)
    write(z, "
    \n
    \n
    \"This
    \n
    \n") close(z) a = open("C9IMAGDICT", "w") write(a, string([noww() * " v" * version, C9imageDict])) close(a) a = open("MATCHES", "w") write(a, string(MATCHES)) close(a) a = open("PUTS", "w") write(a, PUTS) close(a) println(" Time: " * et()) *---- "WBMap" APFS = "030" # WBMap:APFS global version = APFS include("WBInclusions") mutable struct Foo links::Array{String} count::Int32 end global NONEXISTENT = Foo(["NONEXISTENT"],0) global allFiles = Dict{String, Foo}() global excludeds = ["XXXTree.html", "XXXRTree.html", "XXXXTree.html", "IndexOfSubjects.html", "Images.html"] # "NYNYT.html"] global lim = 0 global totLinks = 0 global totExtLinks = 0 global totFiles = 1 global bottomLevel = [] global atLevels = [[1,1],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0], [0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0], [0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]] global totItems = 1 global ignoreds = [ "JUNK.html", "JUNK2.html", "JUNK6.html", "JUNK7.html", "JUNK10.html" ] try global errId = 1 a = readdir() global errId = 2 for itm in a if findfirst(".html", itm) == nothing || itm in ignoreds # || itm == "JSource.html" continue end global totFiles += 1 global errId = 3 sres = RRead(itm, "clean") x = findall(r" href=\"[a-zA-Z0-9\-_]+!?\.html", sres) global totLinks += length(x) global totExtLinks += length(findall(r" href=\"https?://", sres)) if itm in excludeds continue end y = [] for z in x w = sres[z] w = w[8:length(w)] if w in y || w == itm continue end push!(y, w) end allFiles[itm] = Foo(sort(y), 0) end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("\n Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s); exit(16) end println("allFiles: " , length(allFiles)) SEEDFILE = length(ARGS) > 0 ? ARGS[1] : "index" allKeys = sort(collect(keys(allFiles))) if !(SEEDFILE * ".html" in allKeys) println("\n Root file does not exist: \"" * SEEDFILE * "\".") exit(16) end allFiles[SEEDFILE * ".html"].count = 1 global iterations = 0 while iterations < 20 local allFiles_NEW = Dict{String, Foo}() for Key in allKeys allFiles_NEW[Key] = Foo(copy(allFiles[Key].links),allFiles[Key].count ) end global iterations += 1 if iterations > 18 println("Overflow!") exit(16) end local thisLevel = [] local nextLevel = [] local addedInNextLevel = [] for Key in allKeys if allFiles[Key].count == 1 push!(thisLevel, Key) push!(nextLevel, Key) for itm in allFiles[Key].links if itm in excludeds continue end if get!(allFiles,itm,NONEXISTENT) == NONEXISTENT println("Key error: \"" * Key * "\" > \"" * itm * "\"") exit(16) end if allFiles_NEW[itm].count == 0 allFiles_NEW[itm].count = 1 push!(addedInNextLevel, itm) push!(nextLevel, itm) atLevels[iterations + 1][1] += 1 global totItems += 1 atLevels[iterations + 1][2] = totItems end end end end if length(thisLevel) == length(nextLevel) break end global bottomLevel = addedInNextLevel global allFiles = allFiles_NEW end println("\n WBMap v" * version * "\n totFiles: " * string(totFiles) * " iterations: " * string(iterations) * ".\n totLinks: " * string(totLinks) * ":" * string(totExtLinks) * " Root: \"" * SEEDFILE * "\"\n") global THEREST = "" global disconnecteds = 0 for Key in allKeys itm = allFiles[Key] if itm.count == 0 && !(Key in ["WWWTree.html","WWWRTree.html","WWWXTree.html"]) global THEREST *= "\n " * Key global disconnecteds += 1 end end global atLevels2 = [] for i in 1 : 100 if atLevels[i] == [0,0] break end x = [i, atLevels[i][1], atLevels[i][2]] push!(atLevels2, x) end tt = atLevels2[length(atLevels2)][3] ttt = [] for i in 1 : length(atLevels2) alti = atLevels2[i] #altk = string((alti[3]/tt) * 100 + 0.005) * "0000" altj = replace(string((alti[3]/tt) * 100 + 0.005) * "0000", r"\.([0-9]{2})[0-9]+" => s".\1%") push!(ttt, [alti[1], alti[2], alti[3], altj]) end shit = ttt[length(ttt)][3] ttt = replace(string(ttt), "\"" => "") ttt = ttt[5:length(ttt) - 1] ttt = replace(ttt, r"Any\[([0-9]+)," => s"[\1:") ttt = replace(ttt, r"\[([0-9]+)\: ([0-9]+), ([0-9]+)," => s"\1: [\2, \3.") ttt = replace(ttt, ".00" => "") ttt = replace(ttt, r", (5|9|13|17|21|25|29):" => s",\n \1:") ttt = replace(ttt, r"(\d+\.?\d*%)" => SubstitutionString(HI_YELLOW * "\\1" * HI_END)) println(" ", iterations, " " , ttt, " ", atLevels2[length(atLevels2)][2] + length(excludeds) + disconnecteds, " " , shit, "\n " , THEREST * "\n\n", bottomLevel) *---- "w/WBcompare" include("../WBInclusions") using HTTP include("DICT") #pushD("Oh My God", ['G', "G2"]) APFS = "032" # WBcompare:APFS version = APFS global CLEANUPLOCALONLY = length(ARGS) == 2 || ARGS[2] == "CLEANUP" global ANALYZEALL = length(ARGS) == 2 || ARGS[2] == "MICE" if !CLEANUPLOCALONLY && !ANALYZEALL println("No operation specified. No work done. Exiting...." exit(16) end global big = 150000 global BIGS = [] global t = time(); global PrevTime = 0.0 global URLroot = "https://www.bmccedd.org/w/images/" println("\n Remote: " * URLroot * "\n (Bad: remote -> local len)\n") global tbl = Array{String}(undef, 2100) global sz = 0 global totlen = 0 function myPrintln(txt...) for t in txt write(LOG, string(t)) end write(LOG, "\n") println(txt...) end function getImage(img) global errId = 0 try global errId = 1 a = HTTP.get(URLroot * img) global errId = 2 ab = a.body global errId = 3 global errId = 4 fb = RRead("./images/" * img, "raw") global errId = 6 return([ab, fb]) catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end myPrintln("\n Failure[" * string(errId) * "]: ", typeof(ex), ".\n", s); #exit(16) return nothing end end global LOG = open("WBC.log", "w") global others = [] for (root, dirs, files) in walkdir(".") for file in files x = joinpath(root, file) # path to files if !contains(x, "images") push!(others,x) continue end global sz += 1 tbl[sz] = replace(x[10:length(x)], "\\" => "/") q = getD(tbl[sz][6:length(tbl[sz])]) # println("---- \"", q, "\" ", typeof(q)) # God damn strong typing! [string, string, int?] if q == MISSING myPrintln("============> Missing from DICT: \"" * tbl[sz] * "\"") if CLEANUPLOCALONLY rm("images/" * tbl[sz]) end push!(q, 1) continue end push!(q, 0) end end for itm in keys(D) if length(D[itm]) < 3 myPrintln("============> Missing from local: \"" * itm * "\" \"" * string(D[itm]) * "\"") end end # Kludge to get rid of dead files in a remote setup if !ANALYZEALL exit(0) end for i = 1 : sz tbli = tbl[i] sleep(1) if i % 50 == 0 ii = " " * string(i) lenii = length(ii) ii = ii[lenii - 4 : lenii] NewTime = round(time() - t, digits=4) #dt = string(Dates.now()) #dtx = findfirst('T', dt) #noww = dt[1: dtx - 1] * " " * dt[dtx + 1: 19] tdiff = replace(string(NewTime - PrevTime), r"\.\d+" => "") myPrintln("---- Processed " * ii * " files. " * noww() * " ---- ", NewTime, " (", tdiff, ")") global PrevTime = NewTime end x = getImage(tbli) if x == nothing continue end lenx1 = length(x[1]) lenx2 = length(x[2]) global totlen += lenx1 if lenx1 != lenx2 || x[1] != x[2] myPrintln(" Bad: " * string(i) * ". " * tbli[1:5] * " " * tbli[6:length(tbli)] * " " * string(lenx1) * " " * string(lenx2) ) end bigger = max(lenx1, lenx2) if bigger >= big push!(BIGS, string(bigger) * ":" * tbli) end end a = join(sort(BIGS, rev=true),"\n") b = replace(a, ":" => " ") b = replace(b, r"( [0-9a-f]/[0-9a-f]{2})/" => s" \1 ") z = open("WBIG", "w") write(z, b * "\n\n" * join(sort(others),"\n")) close(z) stotlen = formatFixed(totlen) tmt = time() - t myPrintln("\n" * string(sz) * " files in directories. " * stotlen * " total length. v" * version * " ", string(round(tmt, digits=4)) * " (" * string(round(tmt / 60, digits=3)) * ")\n") write(LOG, "\n") close(LOG) *---- "WBheads" include("WBInclusions") using HTTP APFS = "010" # WBheads:APFS global versionNr = APFS global failures = [] global attns = [] txt = RRead("XXXXTree.html", "asis") urls = findall(r"href=\"[^\"]+", txt) global ctr = 0; for urlx in urls global item = txt[urlx] if !contains(item, "http") continue end global ctr += 1 global item = item[7 : length(item)] try print(" ", ctr, ". ", item) heads = HTTP.head(item, readtimeout=15) sx = string(heads.status) sxx = "" if sx != "200" sxx = "ATTN: " push!(attns, item) end println(" ", sxx, sx) catch ex s = string(ex) println(" **Failed**") if length(s) > 200 s = s[1:200] * "..." end push!(failures, (item * " =>\n" * s)) end end println("\nWBheads v", versionNr, ". Count: " , ctr , ".") println("\n", attns) println("--------") global ctr = 0 for f in failures global ctr += 1 println("\n", ctr, " (" ,formatDigits((failures/ctr) * 100, 2) "%)", f) end *---- "WBW" include("WBInclusions") using HTTP global HICOLOR = HI_AQUA global version = "052" global downLoadCount = 0 global downLoadLength = 0 if length(ARGS) == 0 || beginswith(ARGS[1], r"[wWpPtT]") # Read file "V1" and execute it. This sets variable "V", from which we set V_2 EMP(replace(String(HTTP.get("https://www.bmccedd.org/V1").body), "\n *" => "")) global V_2 = V[2] global doStart = true global didSomething = false global progressCTR = 0 global findTS = r">\+\d{4}\.\d{2}\.\d{2} v\d{3}" function doOne(fname, txt, oldRVA) cc = "https://www.bmccedd.org/" * fname f = open(fname, "w") newBody0 = HTTP.get(cc).body write(f, newBody0) close(f) newBody = String(newBody0) global downLoadLength += length(newBody) global downLoadCount += 1 allVStamps = findall(findTS, newBody) lenAV = length(allVStamps) if lenAV != 1 && !(fname == "Experiment.html" && lenAV == 3) # KLUDGE println(hilite(HICOLOR, "Versioning doOne wrong in file: " * fname)) exit(16) end rv = parse(Int32, newBody[allVStamps[lenAV]][15:17]) newRVA = "0000" * string(rv) newRVA = newRVA[length(newRVA) - 3: length(newRVA)] v = get(V_2, fname, "----") if v == "----" println(hilite(HICOLOR, " doOne In target but not in source: " * fname)) elseif v != newRVA println(hilite(HICOLOR, " ====> doOne remote not match V_2 for " * fname * ": (" * oldRVA * ") " * newRVA * " ? " * v)) end println(txt) global didSomething = true end #2022-10-13 16:12 ChangeLog.html println("\nWBW v" * version * ". lenV: " * string(length(V_2)) * ". T/stmp: " * V[1] * "\n") try aLocal = readdir() for itm in aLocal if findfirst(".html", itm) == nothing || startswith(itm, r"XXX|JUNK") continue end FileContents = RRead(itm, "asis") allVStamps = findall(findTS, FileContents) lenAV = length(allVStamps) if lenAV != 1 && !(itm == "Experiment.html" && lenAV == 3) # KLUDGE println(hilite(HICOLOR, "Versioning local wrong in file: " * string(lenAV) * " " * itm)) exit(16) end rv = parse(Int32, FileContents[allVStamps[lenAV]][15:17]) currentRVA = "0000" * string(rv) lenCRVA = length(currentRVA) currentRVA = currentRVA[lenCRVA - 3: lenCRVA] v = get(V_2, itm, "----") if v == "----" println(hilite(HICOLOR, " In target but not in source: " * itm)) elseif v != currentRVA if v > currentRVA doOne(itm, " Updated " * currentRVA * " > " * v * " " * itm, currentRVA) else println(hilite(HICOLOR, " <<<< \"" * itm * "\" " * v * " < " * currentRVA * " <<<<")) end end delete!(V_2, itm) end for k in keys(V_2) doOne(k, " Added " * k, "n/a") end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println(hilite(HICOLOR, "\n Failure: " * string(typeof(ex)) * ".\n" * s)) return 16 end if didSomething println(" \n Downloaded: " * formatFixed(downLoadLength) * " " * formatFixed(downLoadCount) * "\n") end end if length(ARGS) > 0 && !beginswith(ARGS[1], r"[iI]") println(hilite(HICOLOR, "Invalid ARGS[1]: \"" * ARGS[1] * "\"")) exit(16) end global doEnd = false global doStart = true # 2022-10-02 15:12 w/images/c/cc SmilingLady.jpg 123 b = split(String(HTTP.get("https://www.bmccedd.org/V2").body), "\n") println("WBYY v" * version) for itm in b if length(itm) < 42 || itm[24:32] != "w/images/" continue end try d = findlast(" ", itm).start c = itm[24:36] * "/" * itm[40:d - 1] len = itm[d + 1: length(itm)] doit = true what = "new " * len if isfile(c) sz = string(stat(c).size) what = (doit = (sz = string(stat(c).size)) != len) == true ? sz * ":" * len : len end if doit c113 = c[1:13] if !isdir(c113) && isdir(c[1:10]) mkdir(c113) print(" [ New directory: " * c113 * " ] ") end cc = "https://www.bmccedd.org/" * c if doStart println(" ") global doStart = false end print(" " * cc) #res = HTTP.get(cc) f = open(c, "w") write(f, HTTP.get(cc).body) close(f) println(" Done. " * what) global doEnd = true end catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println(hilite(HICOLOR, "\n Failure: " * string(typeof(ex)) * ".\n" * s)) #return 0 end end if doEnd println(" ") end *---- "WBX" include("WbInclusions") global errid = 0 global ct = 0 global totct = 0 if length(ARGS) != 2 || ARGS[2] != "MICE" println("ARGS wrong") exit(16) end global XPUTS = "" function myPrintln(x) write(LOG, x * "\n") println(x) end global LOG = open("WBXLOG", "w") global workToDo = [ # r" ((George( W\.? | Walker )?)?Bush)(, |'s, |'s | )" => # s" \1\4", " " Rejected: \"" * f * "\".") continue end fn = f global errid = 3 c = RRead(fn, "asis") global errid = 4 d = c #--- Change function(s) go after here for i = 1 : length(workToDo) d = replace(d, workToDo[i]) end #--- Change function(s) go before here global totct += 1 if c == d myPrintln("--Done: " * f * ". Not fixed!") continue end vStamp = findall(r">\+202[0-9]\.[0-1][0-9]\.[0-3][0-9] v[0-9]{3}<", d) if length(vStamp) != 1 myPrintln("*** Versioning not avaliable for this file: " * string(length(vStamp)) * ": " * f * " ***\n") else v = d[vStamp[1]] w = tryparse(Int32, v[15:17]) w = "00000" * string(w + 1) wLen = length(w) w = w[wLen - 2 : wLen] y = string(Dates.now()) z = ">+" * y[1:4] * "." * y[6:7] * "." * y[9:10] * " v" * w * "<" q = d global d = replace(d, v => z, count = 1) if d == q myPrintln("God knows qhat fucked up: " * f) end end global ct += 1 global errid = 5 b = open(fn, "w") global errid = 6 write(b, d) global errid = 7 close(b) myPrintln("++Done: " * f * " Fixed.") global XPUTS *= "put " * f * "\n" end global errid = 8 catch ex s = string(ex) if length(s) > 200 s = s[1:200] * "..." end myPrintln("\n Failure[" * string(errid) * "]: " * string(typeof(ex)) * ".\n" * s) exit(16) end close(LOG) # Write file of a "put " statement for each changed file a = open("XPUTS", "w") write(a, XPUTS) close(a) tct = "\n+" * replace(replace(noww(), "-" => "."), " " => "+")[1:16] * ". WBX Total: " * string(ct) * "/" * string(totct) println(tct, "\n") global strs = open("JUNK4.txt", "a") write(strs, "\n" * tct * "\n") for i = 1 : length(workToDo) write(strs, string(workToDo[i]) * "\n") end close(strs) *---- "WBY" DIR = "/ROM/BO/" include(DIR * "WBInclusions") include(DIR * "w/DICT") if length(ARGS) > 0 global lim = tryparse(Int32,ARGS[1]) else global lim = 20 end global OUTPUTFILE = DIR * "V2" global FILE = open(OUTPUTFILE, "w") function myPrintln(x) println(x) write(FILE, x * "\n") end global k = keys(D) global arry = [] global prv = "xxxxxxxxxxxxxx" for ky in k if findfirst(" ", ky) != nothing || findfirst(r"\.(jpg|gif|png)$", ky) == nothing println("\nDICT ERROR! \"" * ky * "\"") exit(16) end x = D[ky] y = DIR * "w/images/" * x[1] * "/" * x[2] * "/" * ky z = string(Dates.unix2datetime(mtime(y))) push!(arry, " " * z[1:10] * " " * z[12:16] * " w/images/" * x[1] * "/" * x[2] * " " * ky) end myPrintln("\n" * string(length(D)) * " WBY: ." * OUTPUTFILE * " " * APtS_ET * "\n") arry2 = sort(arry, rev=true) for i = 1 : min(length(arry2),lim) ii = arry2[i] gkw = DIR * ii[24:36] * "/" * ii[40:length(arry2[i])] lenk = string(stat(gkw).size) if ii[1:7] == prv[1:7] if ii[1:10] == prv[1:10] if ii[1:13] == prv[1:13] myPrintln( " " * ii[14:length(arry2[i])] * " " * lenk) continue end myPrintln( " " * ii[11:length(arry2[i])] * " " * lenk) global prv = ii[1:13] continue end global prv = ii[1:13] myPrintln( " " * ii[8:length(arry2[i])] * " " * lenk) continue end global prv = ii[1:13] myPrintln(arry2[i] * " " * lenk) end close(FILE) *---- "WBZ" include("WBInclusions") include("w/DICT") #using WAV #y, fs = wavread(raw"C:\Windows\Media\Ring01.wav") #wavplay(y, fs) APFS = "0168" # WBZ:APFS global versionNr = APFS include("WBInclusions") global hex = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] global xx = [] global usedDirectories = fill!(Array{Bool}(undef,256),false) global assholes = 0 println("\n WBZ v" * versionNr * ". ARGS ", ARGS, " ", APtS_ET) if length(ARGS) == 0 txt = RRead("w/WBKountOut.html", "asis") sall = findall(r"href=\"images[^\"]+\"", txt) for i = 1 : length(sall) sa = sall[i] push!(xx,txt[sa.start + 18 : sa.stop - 1]) end elseif length(ARGS) == 1 global xx = split(replace(ARGS[1]," " => ""), ',') elseif length(ARGS) > 0 global xx = ARGS end shit = [] for s = 1:256 append!(shit,0) end global first = "" # "\n" for x in xx #y = collect(x) #leny = length(y) #Ltot = 0 # leny #for i = 1 : leny # Ltot += Int32(y[i]) #end Ltot = sum(map(Int32, collect(x))) # Fun! ttt = Ltot % 256 shit[ttt + 1] += 1 v = Int32(ttt % 16) w = Int32((ttt - v) / 16) if usedDirectories[ttt + 1] == false global assholes += 1; usedDirectories[ttt + 1] = true end if length(ARGS) > 0 wplus1 = w + 1 lenD = length(readdir("w/images/" * hex[wplus1] * "/" * hex[wplus1] * hex[v + 1] * "/")) println("\n", first * " " * hex[wplus1] * "/" * hex[wplus1] * hex[v + 1] * " " * x * " (" , lenD, ") " , (getD(x) == MISSING ? "" : HI_RED * " Already used!" * HI_END)) global first = "" end end global shi = [] global shid = [] for s = 1:20 append!(shi,0) end global crap = "" for i = 1 : length(shit) if i % 32 == 1 global crap *= " " if i % 64 == 1 global crap *= "\n " end end shi[shit[i] + 1] += 1 global crap *= HILITE_TOHEX[shit[i]] end shiORIG = copy(shi) global mulch = 0 for i = 1: length(shi) global mulch += (i - 1) * shi[i] if shi[i] != 0 global shi[i] = [i - 1, shi[i], mulch] end end for i = 1 : length(shi) if shi[length(shi)] != 0 break end global shi = copy(shi)[1:length(shi) - 1] end global shidt = 0 for i = 2 : length(shi) if shi[i] == 0 append!(shid, 0) continue end sh = shi[i][2] # (i - 1) append!(shid, sh) # - shi[i - 1][3]) global shidt += sh end xxx = shi qqqqq = shi[length(shi)][3] #println("\n\n", shi, "\n") ss1 = SubstitutionString("[\\1, " * HI_YELLOW * "\\2" * HI_END) # s" * "\\1" * t*) ss2 = SubstitutionString(" " * HI_RED * "\\1" * HI_END * "]]") println(crap * " " * string(sum(shiORIG[11 : length(shiORIG)])) * "\n\n" * replace(replace(replace(replace(replace(replace(replace(string(shi), r"\[(\d), (\d+)" => ss1), r"1([01234]), (\d+), " => s"1\1, YY1\2YY2, "), r" (\d+)]]" => ss2), "YY1" => HI_AQUA), "YY2" => HI_END), "], [7," => "],\n [7,"), "], [12," => "],\n [12,") * "]\n\n " * replace(replace(replace(string(map(x -> x < 10 ? string(shid[x]) : ("X" * string(shid[x]) * "Y"), Array(1:length(shid)))), "\"" => ""), "X" => HI_AQUA), "Y" => HI_END) * " " * string(shidt) * " " * string(assholes) ) if length(ARGS) != 0 return(0) end for i = 1:length(xxx) if typeof(xxx[i]) == Vector{Int64} xxx[i] = (i - 1) * xxx[i][2] end end println(" ",xxx, " ", formatDecimal(qqqqq / assholes, 3)) *---- "WB_Transforms" global TVersion = "122" # ******** It is IMPERATIVE to use "\|" not "|" in the search strings! ******** global WB_TODAY = replace(noww()[1:10], "-" => ".") # Throwaway like for WB info display to work right global Transforms = [ "{{APtS_ET}}" => APtS_ET, "{{TOP}}" => "\n\n\n" * "\n" * "\nDona nobis pacem | " * replace(ThisFile, ".html" => "") * # This line has to be filtered out in "j WB" "\n\n" * "\n" * "\n" * "
    ", r"{{FOOTER\|Buttocks\|(\d+)}}" => s"{{FOOTER|Buttocks|\1|210}}", r"{{FOOTER\|WDSG\|(\d+)}}" => s"{{FOOTER|WDSG|\1|140}}", r"{{FOOTER\|K2\|(\d+)}}" => s"{{FOOTER|K2|\1|90}}", r"{{FOOTER\|(WDSG|Buttocks|K2)\|(\d+)\|(\d+)}}" => s"\n\n{{\1|0|0}}\n \n
    \"This
    \n", "{{BOTTOM}}" => "

     

    ", r"{{WDSG\|([0-9]+)\|([0-9]+)}}" => s"
    \"Where
    ", r"{{Buttocks\|([0-9]+)\|([0-9]+)}}" => s"
    \"\"
    Unfortunate for themself, the person who lacks one; unfortunate for others, the person that is one. Don't be an a**hole!
    ", r"{{K2\|([0-9]+)\|([0-9]+)}}" => s"
    \"BMcC
    Invenit et fecit
    ", r"{{NBB\|([^}]+)}}" => s"", "{{TODAY}}" => "{{TODAY|0}}", # The "=>" in the following line was causing WB info display to fuck up when two lines r"{{TODAY\|[^}]+}}" => "+" * WB_TODAY, r"{{DATE\|([\-+])(\d{4})[|.](\d{2})[|.](\d{2})}}" => ## (Parentheses not included)# s"\1\2.\3.\4", r"{{TSV\|([0-9.]+)\|([0-9]+)\|([0-9]+)\|([0-9]+)}}" => ## TimeStamp + Version# s"", "{{ORELSE}}" => "Or else!", "{{FITB}}" => "[fill in the blank]", "{{RIP}}" => "", r"{{I\|([^{}]+)}}" => s"\1", r"{{B\|([^{}]+)}}" => s"\1", r"{{(IB|BI)\|([^{}]+)}}" => ## (IB|BI)# s"\2", "{{AKA}}" => ## (Includes terminating colon (':'))# "aka:", r"{{([Ii])([Ee])}}" => ## (Includes terminating colon (':'))# s"\1.\2.:", r"{{([Ee])([Gg])}}" => ## (Includes terminating colon (':'))# s"\1.\2.:", r"{{([Rr])ef}}" => s"\1ef.:", # r"{{P\|(.)}}" => # s"

    \1", # r"{{PX\|(.)}}" => # s"

    \1", r"{{NBSP\|([-]?\d\d?)}}" => s" ", # Watch out! # "{{HOTLINK|{{imagename}}|text}}" works, but it has to pass thru WB twice. the 1st pass resolves to: # "text" # The 2nd pass resolves the image URL. Jesus Christ, but it does work. r"{{HOTLINK\|([^|]+)\|([^}]+)}}" =>## This tag may need to pass thru WB twice# s"\2", r"{{CROSSLINK\|([^|]+)\|([^}]+)}}" => s"*", "{{DOTS}}" => "

    *      *      *      *      *      *      *

    ", r"{{TC\|([^\|}]+)\|([^}]+)}}" => ## Text blurb with hyperlink# s"{{TC|\1}}", r"{{TC\|([^}]+)}}" => s"\"[", r"{{HTML5V\|([0-9]+)\|([0-9]+)}}" => s"
    \"This
    ", r"{{HTML5\|(\d+)}}" => s"
     \"This
    ", "{{IBM}}" => "IBM", "{{StP}}" => "St. Paul's Illiberal Day Carcel for pubsecent male virgins except-for-omerta-sanitary-services-for-jocks", "{{THINK}}" => "THINK", "{{IRC}}" => ## Int'l Rescue Commitee# "\"Help", r"{{BMcC}}" => "({{BMcC|}})", r"{{BMcC\|[^}]*}}" => ## (Any parameter value for no perentheses)# "BMcC[18-11-46-503]", "{{EMAIL}}" => "bradmcc@bmccedd.org", "{{BO}}" => ## Help protect The American Dream from body odor!# "{{BO|Americanism.html}}", r"{{BO\|([^}]+)}}" => s"", r"{{([Pp])eople}}" => s"\1eople", r"{{([Tt])he([my])}}" => s"\1he\2", r"{{([lr])AQUO}}" => s"&\1aquo;", "{{CLEAR}}" => "
    ", r"{{BIDEN\|([^}|)]+)}}" => s"{{BIDEN|\1|}}", r"{{BIDEN\|([^|)]+)\|([^}]*)}}" => ## User must code 1 space after 2nd "|" before 2nd date# s"[\1 \2]", r"{{BQ\|([^|{}\"]+)\|([^|{}\"]*)}}" => ## Quotes ('"') are killers!# s"
    \n\"\1\"\2\n
    ", ] *---- "WBdiff" include("WBInclusions") global Version = "005" if length(ARGS) < 1 || !(endswith(ARGS[1], ".html")) println("\nIncorrect paramater shit") exit(16) end global ARGS1 = ARGS[1] global ARGS1_NAKED = ARGS1[1:length(ARGS1) - 5] global a = readdir("/backups") global x = "" global xshit = "" global xshitb = "" for item in a if !(startswith(item, ARGS1)) continue end ix = length(ARGS1) seq = item[ix + 4 : length(item)] shit = " " ^ (6 - length(seq)) seq = shit * seq itemx = ARGS1 * ".qw" * seq if itemx > x global x = itemx global xshit = xshitb global xshitb = item end end xshitfull = "/backups/" * xshit old = RRead(xshitfull, "asis") new = RRead(ARGS1, "asis") REGEX = Regex("[a-zA-Z_ ]+\\| (" * ARGS1_NAKED * "|F\\*ckedUp)") DIMGRAY = r" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}" QQQQQ = r" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}()?" global QDict = Dict( # Omit the goddamned ".html" in the keys! "welcome" => r" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}()?", "WhomIWouldLikeToBe" => r" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "index" => r"color:blue\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "index1" => r" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Biden1" => r"font-size:15px;\">\+\d{4}\.\d{2}\.\d{2} v\d{3}  r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Churchill" => r"color:darkslategray;\" title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Maybe" => r"title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Puns" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3} Ha! Ha!", "Security" => r"title=\"Last change date\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Seiho" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "ShortStory0" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "StP" => r";color:blue;\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "StP2" => r";color:blue;\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Suburbia3" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Thanks" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}\. r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Waldo2" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Zelensky0" => r"color:blue;\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Zelensky2" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Petty0" => r";color:blue;\">\+\d{4}\.\d{2}\.\d{2} v\d{3}", "Date" => r"none;\">\+\d{4}\.\d{2}\.\d{2} v\d{3} Nunc", "MrSAthertonMiddleton" => r"\+\d{4}\.\d{2}\.\d{2} v\d{3}", "EndOfEarth" => r"color:darkslategray;\" title=\"Last change\">\+\d{4}\.\d{2}\.\d{2} v\d{3}\. So what", "BodyOdorDarkness" => DIMGRAY, "ZelenskyDarkness" => DIMGRAY, "155mm" => DIMGRAY, "BlackHole" => DIMGRAY, ) QQQQQN = "DONTCARE1DONTCARE1" RRRRR = "\n" RRRRRN = "DONTCARE2DONTCARE2" function repl(in, from, to, id) orig = in out = replace(in, from => to, count = 1) if orig == out println("\n" * HI_RED * "******** COULD NOT COMPARE FILES: " * string(id) * ": \"" * xshit * "\" ********" * HI_END) exit(16) end return out end global PERVERT = haskey(QDict, ARGS1_NAKED) global oldx = repl(old, get!(QDict, ARGS1_NAKED, QQQQQ), QQQQQN, 1) global oldx = repl(oldx, REGEX, RRRRRN, 2) global oldx = repl(oldx, RRRRR, "", 3) global newx = repl(new, get!(QDict, ARGS1_NAKED, QQQQQ), QQQQQN, 4) global newx = repl(newx, REGEX, RRRRRN, 5) global newx = repl(newx, RRRRR, "", 6) println("\n" * LO_GRAY * "WBdiff v" * Version * "." * HI_END * " " * xshit * " (" * formatFixed(length(new)) * ")" * (PERVERT ? "***" : "") * " " * (newx == oldx ? HI_YELLOW* "No changes" : HI_AQUA * "Changed!") * HI_END * "\n") *---- "ZZ" # Today is or will shortly become Saturday, April 01, 2023, day 402 of this mad include("WBInclusions") global outputFile = "kx.txt" version = "012" if isfile(outputFile) s = RRead(outputFile, "asis") if findfirst(r"[ \r\n]+[*]{3}", s) != nothing println(HI_RED * "\n******** Output file: " * outputFile * " exists!" * HI_END) exit(16) end end dt = DateTime(now()) + Hour(length(ARGS) == 0 ? 24 : (tryparse(Int64, ARGS[1]) * 24)) z0 = DateTime(dt) - DateTime("2022-02-23T00:00") z = replace(string(div(z0, 86400000)), " milliseconds" => "") DayOfWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"][Dates.dayofweek(dt)] Month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][tryparse(Int32,replace(string(Dates.Month(dt)), r" months?" => ""))] Day = replace(string(Dates.Day(dt)), r" days?" => "") if length(Day) == 1 Day = "0" * Day end DATE = DayOfWeek * ", " * Month * " " * Day * ", " * string(Dates.Year(dt))[1:4] * ", day " * z println("\n ZZ v" * version * " (\"" * outputFile * "\") \"" * HI_YELLOW * DATE * HI_END * "\"") global txt = RRead("w/txts/k1.txt", "asis") global txt = replace(txt, "***" => "") if length(ARGS) > 0 global txt = replace(txt, "or will shortly become " => "") end global txt = replace(txt, "Saturday, April 01, 2023, day 402" => DATE) a = open(outputFile, "w") write(a, txt) close(a) run(`"\windows\System32\notepad.exe" $outputFile`) *---- "WBM" include("WBInclusions") global ThisFile = "Filler.html" include("WB_Transforms") global MDN = "MACRODICT" # EMP("global MACRODICT = " * RRead("MACRODICT", "asis")) # I make mountains out of molehills: # global DICT = EMP(EMP("global " * MDN * " = RRead(\"" * MDN * "\", \"asis\")")) global dict = EMP(RRead(MDN, "asis")) global DICT = dict[2] global KWHO = Dict{String,Int32}() for itm in Transforms temp = string(itm.first) KWHO[temp] = get!(DICT, temp, 0) # This adds elements to MACRODICT, too! end a1 = replace(string(KWHO), "}}\\\"i\"" => "}}") # God nows what mess for key that ends with '}}"i' a = replace(replace(replace(replace(string(a1), r"(, |Int32}\()" => "\n"), r"(r\\|\\\")" => ""), "\\ =" => " ="),r" (\d+)\)" => s" \1") b = replace(replace(replace(replace(replace(a, "\\\\|" => " | "), r"({{|}})" => s" "), "=>" => ""), r"\| [^ ]+" => ""), r" ([^ ]+) +(\d+)" => s" \2 \1") b = replace(b, r" (\d) " => s" \1 ") b = replace(b, r" (\d{2}) " => s" \1 ") b = replace(b, r" (\d{3}) " => s" \1 ") b = replace(b, r" (\d{4}) " => s" \1 ") b = replace(b, r" (\d{5}) " => s"\1 ") c = split(b, "\n") x = [] for i = 1 : length(c) push!(x, (findfirst("BIDEN", c[i]) == nothing ? "a" : " ") * c[i]) # BIDEN is worthless end y = sort(x, rev=true) println("") global firstbreak = true global HILITE_COLOR = HI_YELLOW global pct = (dict[1][3] / dict[1][2]) * 100 # WB counters added +2023.11.08 global ver = " v023 (" * string(length(KWHO) - 1) * ") " * hilite(HI_YELLOW, MDN) * " " * string(dict[1][1]) * " " * string(dict[1][2]) * " " * string(dict[1][3]) * " (" * formatDecimal(pct,2) * "%)" for i = 2 : length(y) yi = replace(y[i], r"^a" => " ") breaker = "" if findfirst(" 0 ", yi) != nothing if firstbreak breaker = "\n" global HILITE_COLOR = "" global firstbreak = false end end biden = findfirst("BIDEN", yi) != nothing println(breaker * " " * hilite(biden ? LO_GRAY : HILITE_COLOR, yi), ver) global ver = "" end *---- "Quora" include("WBInclusions") # Quora [1|9] Quora[nn] global version = "v006" global QuoraFile = "Quora11.html" if length(ARGS) != 2 || (ARGS[2] * ".html" != QuoraFile) println("Wrong!") exit(16) end if "1" == ARGS[1] global a = RRead(QuoraFile, "asis") b = findall(">¶<", a) lenb = length(b) println(version, " 1: ", lenb) for i = 1 : lenb ii = lenb + 1 - i aii = b[ii] global a = a[1:aii.start - 1] * " id=\"z" * string(ii) * "\">¶<" * a[aii.stop + 1:length(a)] end z = open("QT1", "w") write(z, a) close(z) exit(0) end if "9" != ARGS[1] return(0) end global a = RRead(QuoraFile, "asis") global toc = "" global b = findall(r"

    ", a) global bshit = findall(r"

    |\n)", a) for i = 1 : min(length(b), length(bshit)) if b[i] != bshit[i] println("\n **", a[b[i]], "**\n\n **", a[bshit[i]], "**\n") exit(16) end end global lenb = length(b) println(version, " 9: ", lenb) for i = 1 : lenb c = a[b[i]] d = replace(c, " " " href=\"#z", count = 1) d = replace(d, "¶" => "¶") d = replace(d, " "" => "
    \n") global toc *= d end z = open("QT9", "w") write(z, toc) close(z) *---- "C9images" include("WBInclusions") global VERSION = "008" global BASE = "/ROM/BO/c9/" global OKs = Dict() AGOs = [] USERS = Dict{String, Int32}() EMP("global C9IMAGDICT = " * RRead("C9IMAGDICT", "asis")) global ix = 1 function RD(dir) # println(" dir: \"",dir, "\"") files = readdir(dir) for f in files if isdir(dir * f) RD(dir * f * "/") continue end if !(endswith(f, ".jpg") || endswith(f, ".gif") || endswith(f, ".png")) continue end global ok = false global notok = 0 global q = "" global force = false while !ok try if isfile("\\Oldimages\\" * f * q) xx = get(OKs, lowercase(f), "SSSSS") mismatch = "" if (xx != "SSSSS") && (RRead(dir * f, "raw") != RRead(xx, "raw")) mismatch = " " * HI_RED * "MISMATCH!" * HI_END end println("\\Oldimages\\" * f * q * " ?? " * dir * f * " ?? " * get(OKs, lowercase(f), HI_AQUA * xx * HI_END) * mismatch) ok = true continue end cp(dir * f, "\\Oldimages\\" * f * q) mt = stat(dir * f) #println(" " * dir * f * " " , string(stat(dir * f).mtime)) #println("OK ", dir * f , " ", "\\Oldimages\\" * f * q) OKs[f] = lowercase(dir * f) push!(AGOs,[stat(dir * f).mtime, dir*f]) ok = true catch ex local s = string(ex) if length(s) > 200 s = s[1:200] * "..." end println("Failure: ", dir * f * " " * typeof(ex), ".\n", s); ok = true end end global ix += 1 end end foreach(rm, filter(contains("."), readdir("/OLDIMAGES",join=true))) # What a shit! RD(BASE) LIST1 = [] LIST2 = [] global USED = 0 AGOss = sort(AGOs,by = x -> x[1], rev = true) for item in AGOss xxx = item[2][12:length(item[2])] xxxx = "" xxxxx = "" if (a = get(C9IMAGDICT[2], xxx, "NUTHIN")) != "NUTHIN" xxxx = " " * replace(replace(replace(string(a), r"Dict{String, (Int32|Any)}" => ""), r"[()]" => ""), r"\" => (\d+)," => s"\" => \1,") * "" xxxxx = " USED" global USED += 1 for u in keys(a) if u in keys(USERS) USERS[u] += 1 else USERS[u] = 1 end end end # s" \1:\2") push!(LIST2, replace(replace(string(Dates.unix2datetime(item[1])), r"T(\d{2}):(\d{2}).*" => " "), "-" => ".") * " " * xxxxx * "" * xxx * " " * xxxx) end AGOst = sort(AGOs, by = x -> lowercase(x[2])) for item in AGOst xxx = item[2][12:length(item[2])] xxxx = "" xxxxx = "" if (a = get(C9IMAGDICT[2], xxx, "NUTHIN")) != "NUTHIN" xxxx = " " * replace(replace(replace(string(a), r"Dict{String, (Int32|Any)}" => ""), r"[()]" => ""), r"\" => (\d+)," => s"\" => \1,") * "" xxxxx = " USED" end push!(LIST1, replace(replace(string(Dates.unix2datetime(item[1])), r"T(\d{2}):(\d{2}).*" => " "), "-" => ".") * " " * xxxxx * "" * xxx * " " * xxxx) end #println("\n\n") global junk10 = open("JUNK10.html", "w") write(junk10, "\n\n\n\nLink inventory\n\n\n\n

    \n
    \n") write(junk10, "

    c9images v" * VERSION * "  [" * C9IMAGDICT[1] * "]
    USED: " * string(USED) * ".  Total: " * formatFixed(length(LIST1)) * ".   Chronological order

    \n" * "\n") for i = 1 : length(LIST1) write(junk10, "" * LIST1[i] * "\n") end write(junk10, "—— Chronological order (Top) ——\n") for i = 1 : length(LIST1) write(junk10, "" * LIST2[i] * "\n") end global U = "" Uc = "" println(USERS) sds = [] for k in keys(USERS) push!(sds, string(k)) end for u in sort(sds, by = x -> lowercase(x)) global U *= Uc * "" * u * "(" * string(USERS[u]) * ")" global Uc = ", " end write(junk10,"\n

    Users(# files ref'd):  " * U * ".

    ") write(junk10, "\n
    \n
    \"This
    \n
    \n") close(junk10) println("ix: ", ix - 1)