Skip to content

Instantly share code, notes, and snippets.

@goyuix
goyuix / Modify-DefaultHive.ps1
Created July 30, 2014 02:57
PowerShell to mount default NTUSER.DAT, modify it and unload it
Write-Host "Attempting to mount default registry hive"
& REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT
Push-Location 'HKLM:\DEFAULT\Software\Microsoft\Internet Explorer'
if (!(Test-Path Main)) {
Write-Warning "Adding missing default keys for IE"
New-Item Main
}
$sp = Get-ItemProperty -Path .\Main
Write-Host "Replacing $_ : $($sp.'Start Page')"
@goyuix
goyuix / P4-RobustGrep
Created September 19, 2012 16:56
Getting around the "grep revision limit exceeded" in Perforce
# p4 dirs //depot/* returns all the top level folders
#
# % means ForEach-Object, e.g. each top level folder from p4 dirs
#
# -s is to quiet the line length > 4096 noise
# -i is to make it case insensitive
# -e is followed by the search expression
# and the last argument is the path to search
p4 dirs //depot/* | % { p4 grep -s -i -e "search expression" "$_/..." }
@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 / 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 = @{}
javascript:(function ($) {
var pages = 20;
function getPosts(page) {
$.get("page/" + page + "/?rand=" + (new Date()).getTime(), function (d) {
$("#post-wrapper").append($(d).find("div.post-wrapper-hentry"));
if (page + 1 < pages) { getPosts(page + 1); }
});
} if (window.jQuery) { getPosts(2); } else {
var s = document.createElement('script');
s.type = "text/javascript";
@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 / 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