Skip to content

Instantly share code, notes, and snippets.

@mike-clark-8192
mike-clark-8192 / clipboard_fmt_privacy_test.html
Created September 29, 2024 16:20
Browser Clipboard API multi-format and privacy tester
<!DOCTYPE html>
<html>
<head>
<title>HTML Clipboard Tester</title>
<style>
body * { margin-top: 10px; font-family: sans-serif; }
input, select, textarea { font-family: sans-serif; }
table, tr, td, th { border: 1px solid black; border-collapse: collapse; }
tr, td, th { padding: 5px; }
</style>
@mike-clark-8192
mike-clark-8192 / $x.js
Created September 28, 2024 07:03
JavaScript port of Chrome Dev Tools `$x`
function $x(selector, contextNode = document) {
// Ensure the selector is provided and is a string
if (!selector || typeof selector !== 'string') {
throw new Error('$x requires a non-empty string as its first argument.');
}
// Ensure the context node is a valid DOM Node
if (!contextNode || !(contextNode instanceof Node)) {
throw new Error('The second argument to $x must be a DOM Node.');
}
@mike-clark-8192
mike-clark-8192 / Clipboard_ExcludeClipboardContentFromMonitorProcessing.html
Created September 27, 2024 19:17
ExcludeClipboardContentFromMonitorProcessing Browser Test
<!DOCTYPE html>
<html>
<head>
<title>HTML Clipboard Tester</title>
<style>
body * { margin-top: 10px; font-family: sans-serif; }
input, select, textarea { font-family: sans-serif; }
table, tr, td, th { border: 1px solid black; border-collapse: collapse; }
tr, td, th { padding: 5px; }
</style>
@mike-clark-8192
mike-clark-8192 / cycle_color_schemes.vim
Created September 13, 2024 17:12
Cycle through Gvim color schemes and display current scheme's name
let g:colors = getcompletion('', 'color')
func! NextColors()
let idx = index(g:colors, g:colors_name)
return (idx + 1 >= len(g:colors) ? g:colors[0] : g:colors[idx + 1])
endfunc
func! PrevColors()
let idx = index(g:colors, g:colors_name)
return (idx - 1 < 0 ? g:colors[-1] : g:colors[idx - 1])
endfunc
nnoremap <silent> <s-a-n> :exe "colo " .. NextColors() \| redraw \| colorsch <CR>
@mike-clark-8192
mike-clark-8192 / commentary.vim
Created September 8, 2024 23:12
Modification of commentary-vim that allows for case-insensitive matching of comment delimiters (e.g., `rem` is no different from `REM` in dosbatch)
" commentary.vim - Comment stuff out
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.3
" echomsg "commentary.vim: before g:loaded_commentary=" . get(g:, 'loaded_commentary', 0)
echom a
if exists("g:loaded_commentary") || v:version < 703
finish
endif
let g:loaded_commentary = 1
@mike-clark-8192
mike-clark-8192 / gh_gql_resize.user.css
Created July 12, 2024 22:16
gh_gql_resize.user.css
/* ==UserStyle==
@name graphql.github.com/explorer - Jul 2024
@namespace github.com/openstyles/stylus
@version 1.0.0
@description A new userstyle
@author Me
==/UserStyle== */
@-moz-document url-prefix("https://graphql.github.com/explorer") {
/* Insert code here... */
}
Windows Registry Editor Version 5.00
; Created by Sergey Tkachenko
; Tutorial: https://winaero.com/how-to-remove-open-in-windows-terminal-context-menu-in-windows-11/
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Blocked]
"{9F156763-7844-4DC4-B2B1-901F640F5155}"=-
"{02DB545A-3E20-46DE-83A5-1329B1E88B6B}"=-
@mike-clark-8192
mike-clark-8192 / reload-profile.ps1
Created May 16, 2024 05:40
PowerShell "reload $profile" "alias" via PSReadLine
function _PSReadLineRewriteCommand {
param($key)
$commandLine = ''
$cursorIndex = 0
[Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$commandLine, [ref]$cursorIndex)
if ($commandLine -eq 'prof' -or $commandLine -eq 'profile') {
[Microsoft.PowerShell.PSConsoleReadLine]::Delete(0, $commandLine.Length)
[Microsoft.PowerShell.PSConsoleReadLine]::Insert('. $profile')
}
[Microsoft.PowerShell.PSConsoleReadLine]::AcceptLine()
@mike-clark-8192
mike-clark-8192 / Program.cs
Last active March 27, 2024 12:34
İ, ı, I, i: an [overly] exhaustive exploration of sorting and comparing in .NET
using Combinatorics.Collections;
using System.Globalization;
namespace StringComparerTest
{
using ComparerInfo = KeyValuePair<string, StringComparer>;
using StringPermutations = IEnumerable<IEnumerable<string>>;
internal class Program
{
@mike-clark-8192
mike-clark-8192 / install_z_sh.sh
Created February 24, 2024 11:23 — forked from mevanlc/install_z_sh.sh
Helper script to install z.sh (jump around) - https://github.com/rupa/z
#!/bin/sh
SOURCE_URL="https://raw.githubusercontent.com/rupa/z/master/z.sh"
OUTPUT_LOC="$HOME/.z.sh"
usage_doc="Usage: $0 [-h] [-u url] [-o file]
-h this help
-u <url> download from <url>
default: $SOURCE_URL
-o <file> download to <file>