Skip to content

Instantly share code, notes, and snippets.

View Beej126's full-sized avatar

Beej Beej126

View GitHub Profile
@Beej126
Beej126 / .gitignore
Last active May 13, 2024 21:46
Windows Sandbox Slipstreamed with Winget
*.appx
*.msixbundle
*.wsb
@Beej126
Beej126 / gist:28114aef95817491a18f2293cfc3d0a6
Created March 7, 2024 09:17
React iterate to generate elements sample
<ul>
{[1, 2, 3, 4, 5].map(i => <li>{i}</li>)}
</ul>
@Beej126
Beej126 / bigcsvsplitter.ps1
Last active June 2, 2022 18:17
Split big CSV quickly (multiple gigs < minute) based on column, powershell with embedded C#
# C# syntax works under both pwsh core and legacy Windows Powershell which is capped at C# 5.0 and .Net Framework vs dotnet core
Add-Type @"
using System;
using System.IO;
public static class BigCsvSplitter
{
public static void Run()
@Beej126
Beej126 / csharp-repl.ps1
Created April 18, 2022 04:07 — forked from noseratio/csharp-repl.ps1
C# REPL with Microsoft.Net.Compilers.Toolset
# https://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset
md cs-repl | cd
nuget install Microsoft.Net.Compilers.Toolset
# run a CS script, a useful alternative to PowerShell itself
echo 'Console.WriteLine("hello");' > script.csx
. (gci -recurse csi.exe).FullName script.csx
# run in REPL mode
@Beej126
Beej126 / script.sh
Created February 4, 2022 01:09
hackintosh config.plist convert hex <=> base64
# base64 to hex
echo -n AwCYPg== | base64 -d | xxd -ps
# hex to base64
echo -n 0300983e | xxd -r -p | base64
@Beej126
Beej126 / .gitignore
Last active February 18, 2023 07:53
dnlib copy source dll methods to destination dll (patch tool)
dest.cs
dest/
save.ps1
source.cs
source.dll
@Beej126
Beej126 / eztv_scraper.js
Last active September 23, 2024 15:42
browser console script for pulling eztv.unblockit.tv episode links in bulk
//helper function
function groupBy(objectArray, property) {
return objectArray.reduce((acc, obj) => {
const key = obj[property];
if (!acc[key]) {
acc[key] = [];
}
// Add object to list for given key's value
acc[key].push(obj);
return acc;
@Beej126
Beej126 / _Readme.md
Last active November 8, 2021 03:22
Windows 11 Explorer context menu to install apk into Subsystem for Android

Prerequisites

  • currently this requires at least Windows 11 insider beta channel - install guide
  • and "adb.exe" must be in your system path - install guide

Install Steps

  1. download these files to a local folder
  2. double click the android_subsys_install_apk_context_menu_setup.cmd

that's it, now you have a new context menu:

@Beej126
Beej126 / instaTeam.js
Last active November 18, 2021 22:31
Hacking instaTeam web api
/////////////////////////////////////////////////////////////////////////////////////////
//first some helper functions to tee up one last clean routine at the bottom
//from: https://stackoverflow.com/questions/951021/what-is-the-javascript-version-of-sleep/39914235#39914235
const sleep = s => new Promise(resolve => setTimeout(resolve, s * 1000));
//from:https://stackoverflow.com/questions/37576685/using-async-await-with-a-foreach-loop/49432189#49432189
Array.prototype.forEachAsync = async function (fn) { for (let t of this) { await fn(t) } }
//get data
@Beej126
Beej126 / dotnet_watch_monitor.ps1
Last active December 22, 2021 17:59
"dotnet watch" output monitor to autorun other tooling
# all syntax is pwsh v7+ compatible
###########################################
# the basic scenario is wanting to fire another codegen tool whenever `dotnet watch run` reports a change to specific source files
# it's very fortunate dotnet watch already reports exactly what we need to trigger on
###########################################
# this code is very customized to watch my ServiceStack webapi project
# and run the ServiceStack CLI tooling that autogens typescript DTOs from C# DTOs.
#
# i've also tailored to watching for specific errors, and trimming the debug output verbosity and changing console text color to catch the eye