Skip to content

Instantly share code, notes, and snippets.

@goyuix
goyuix / helpful.js
Last active September 6, 2021 22:21
Helpful JavaScript
// remove unwanted titles from list of articles
var articles = document.querySelectorAll("article h1 a");
var filters = [/American Horror Story/i,/Naked News/i,/ReidOut With Joy Reid/i,/Real Housewives/i,/Ancient Aliens/i,/Love Island/i,/Love After Lockup/i,/Lawrence O Donnell/i,/Hannity/i,/Ingraham Angle/i,/Tucker Carlson/i,/^WWE /i,/Bill Maher/i,/^Dateline /i,/Brian Williams/i,/Jimmy Kimmel/i,/Rachel Maddow/i,/Seth Meyers/i,/Desus and Mero/i]
articles.forEach(a => { filters.forEach(f => { if (f.test(a.innerText)){a.closest("article").remove();}})})
// remove matching articles by clicking calendar icon in header (by year || season/episode
document.addEventListener("click", function(ev){
var el=ev.target.closest(".entry-header");
if(el){
var a=el.querySelector(".entry-title a");
@goyuix
goyuix / HDR-to-SDR.txt
Created July 16, 2021 23:22
How to use FFMPEG to convert HDR video to SDR (standard dynamic range) while (mostly) retaining the same depth and intensity of colors, without washed-out colors, as the original HDR10+ video.
ffmpeg -i video-input.mp4 -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v libx265 -crf 22 -preset medium -tune fastdecode video-output.mp4
$jhrl = 'https://www.jhrl.com'
$allPropertiesURL = 'https://www.jhrl.com/sites/default/files/btolazyjump/61db5d1311039d5f62b303d5dd7bbc1d.txt'
$wc = New-Object System.Net.WebClient
# Download main page, and parse out actuall properties URL
$baseHTML = $wc.DownloadString($jhrl)
$allPropertiesURL = [Regex]::Matches($baseHTML,'data-bto-jump-select="(.*?). />').Groups[1].Value
# Using downloaded properties info, parse out URL for each property
$rentals = @{}
@goyuix
goyuix / img.js
Created December 5, 2020 16:16
Img replacement magic
document.querySelectorAll("tr.lista2 td.lista:nth-child(2)").forEach(td=>td.parentElement.querySelector("img").src='//'+td.innerHTML.match(/dyncdn\.me.*jpg/)[0])
$rawVersionText = @"
wbadmin 1.0 - Backup command-line tool
(C) Copyright 2013 Microsoft Corporation. All rights reserved.
Backup time: 5/3/2018 9:36 AM
Backup target: 1394/USB Disk labeled Elements(F:)
Version identifier: 05/03/2018-15:36
Can recover: Volume(s), File(s), Application(s), Virtual Machine(s)
Snapshot ID: {445bf85d-efd2-448b-b33a-f97422f3318a}
@goyuix
goyuix / ffmpeg-hevc-mp4-sample.bat
Created February 6, 2018 17:32
Sample ffmpeg encode for x265 HEVC web-optimized MP4
ffmpeg -i input.mkv -movflags faststart -c:v libx265 -crf 25 -c:a aac -b:a 128k output.mp4
@goyuix
goyuix / fos-report.js
Created October 18, 2017 22:31
JavaScript to clean up Friends of Scouting report prior to PDF distribution
// hide donation amount
$("td.currency").hide();
// hide type column
$("tr").each(function(){$(this).find("td:last").hide();});
// hide confusing 'Declined?'value in status column
$("a:contains('Declined')").hide();
// hide navigation bar at top
eac3to.exe "E:\source.mkv" 2: "destination.m4a" -quality=0.5 -downDpl
@goyuix
goyuix / SampleHandler.ashx
Created January 6, 2017 00:21
Sample ASP.NET IHttpHandler implementation
<%@ WebHandler Language="C#" Class="SampleHandler" %>
using System;
using System.Web;
using System.Web.Script.Serialization;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
namespace WECC
{
@goyuix
goyuix / SharePoint-Starter-Script.ps1
Created September 7, 2016 15:08
These are first few lines I add to all my SharePoint on-premises scripts. It makes sure that the script is running with admin privileges and loads the Microsoft.SharePoint.PowerShell module. If there are any issue it aborts the script. It pulls some inspiration from the SharePoint Management Shell initialization script sharepoint.ps1.
function Get-AdminStatus {
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object System.Security.Principal.WindowsPrincipal $identity
$principal.IsInRole
$status = $principal.IsInRole("Administrators")
$principal = $null
$identity.Dispose()
return $status
}