Skip to content

Instantly share code, notes, and snippets.

@cemerson
cemerson / archive.org-scanned-book-downloader-bookmarklet.md
Last active April 24, 2024 18:53
Archive.org Scanned Book Downloader Bookmarklet

Archive.org Scanned Book Downloader Bookmarklet

A simple "1-click" javascript approach to downloading a scanned book from archive.org to read at your leisure on the device of your choosing w/out having to manually screenshot every pages of the book by hand. In short it's a glorified "Save Image As..." approach but consolidated down to "1 click". BTW there may be a much better option than this out there - I just built this as an autistic project to see if it would work.

Demo Video

Archive.org SBDL Demo

Obligatory Legal/Disclaimer:

By using this script you agree to delete all book files/images after your 1 hour or 14 days is up! I don't support using this script for any other use cases. After all, none of us have ever kept a library book past it's return date, right?

@cemerson
cemerson / autohotkey-excel-extract-hyperlinks-from-selected-cells-cemerson.ahk
Last active March 18, 2024 14:23
AutoHotkey/Excel: Extract Hyperlinks from Selected Cells
@cemerson
cemerson / chatgtp-fix-export-button-hack.js
Created February 9, 2024 11:01
ChatGPT: Fix app export buttons (hack)
async function fixChatGPTExport() {
chatConf = (await invoke('get_app_conf')) || {};
actionsArea = document.querySelector('form>div>div>div');
function shouldAddButtons(actionsArea) {
// first, check if there's a "Try Again" button and no other buttons
const buttons = actionsArea.querySelectorAll('button');
const hasTryAgainButton = Array.from(buttons).some((button) => {
return !/download-/.test(button.id);
@cemerson
cemerson / ms-excel-delete-all-worksheets-but-one-2024.md
Created January 16, 2024 13:37
MS Excel - Delete All Worksheets at once but one

In Microsoft Excel, there isn't a built-in feature to delete all worksheets except one directly. However, you can use a VBA (Visual Basic for Applications) macro to achieve this. Here's a step-by-step guide:

Press Alt + F11 to open the VBA editor. In the editor, insert a new module by right-clicking on any item in the Project Explorer, selecting Insert, and then choosing Module. Copy and paste the following VBA code into the module: vba Copy code Sub DeleteAllSheetsExceptOne() Dim ws As Worksheet Dim wsToKeep As Worksheet

@cemerson
cemerson / TSQL-replace-string-in-entire-database.sql
Created November 11, 2021 11:30
SQL replace all instances of string in all tables of entire database
/* ------------------------------------------------------- /
TITLE: SQL Server Find and Replace Values in All
Tables and All Text Columns
SOURCE: https://www.mssqltips.com/sqlservertip/1555/sql-server-find-and-replace-values-in-all-tables-and-all-text-columns/
/ ------------------------------------------------------- */
USE MyDatabaseNameHere
BEGIN TRANSACTION
@cemerson
cemerson / download-cspan-videos-clips-to-mp4-with-youtube-dl.md
Last active November 30, 2023 17:15
Download CSPAN videos/clips to MP4 with YouTube-DL

How to download CSPAN clips to MP4 in Windows with YouTube-DL

  1. Install Youtube-DL so it's in your path/command line (https://github.com/ytdl-org)

  2. Get Two URLs ready to copy/paste. Both the URL of the CSPAN page w/the video and the M3U8 URL of the video. Get the M3U8 by viewing the page source and looking for ".m3u8". Examples (page): https://www.c-span.org/video/?c4990755/user-clip-johnson-covid-response (m3u8): https://m3u8-1.c-spanvideo.org/clip/clip.4954874.m3u8

  3. Run the line below in a Windows command prompt. Make sure to first replace the #M3U8_URL# and #CSPAN_VIDEO_PAGE_URL# with your URLs from step #2

@cemerson
cemerson / ssl-generate-self-signed-cert-2023111x.md
Created November 16, 2023 13:34
SSL: Generate self signed cert via powershell

// Run in powershell as admin - change all ##values## as needed

$authorityCert = New-SelfSignedCertificate -Subject "CN=##MyCertFriendlyName##,OU=IT,O=##MyCompanyName## Certificate Authority,C=US" -KeyAlgorithm RSA -KeyLength 4096 -KeyUsage CertSign, CRLSign, DigitalSignature, KeyEncipherment, DataEncipherment -KeyExportPolicy Exportable -NotBefore (Get-Date) -NotAfter (Get-Date).AddYears(10)

@cemerson
cemerson / chrome-fix-the-your-connection-is-not-private-issue-for-localhost-dev-work.md
Created November 15, 2023 11:14
Chrome: Fix the Your Connection is not Private issue for localhost dev work

In Chrome, browse to: chrome://flags/ . Search for “insecure” and you should see the option to “Allow invalid certificates for resources loaded from localhost.” Enable that option and restart your browser.Oct 18, 2023

@cemerson
cemerson / bookmarklet-rumble-com-sort-video-search-results-by-duration.js
Created November 13, 2023 10:58
Rumble.com: Bookmarklet sort video search results by duration
/* Rumble.com: Sort video search results page by duration (low to high) */ javascript:(function() {%0A %2F%2F Get all the <li> elements with the class 'video-listing-entry'%0A const videoEntries %3D document.querySelectorAll('li.video-listing-entry')%3B%0A%0A %2F%2F Convert the NodeList to an array for easier sorting%0A const videoEntriesArray %3D Array.from(videoEntries)%3B%0A%0A %2F%2F Custom sorting function to sort by video duration%0A function compareDurations(a%2C b) %7B%0A %2F%2F Get the duration values from the data-value attribute of <span> elements%0A const durationA %3D a.querySelector('.video-item--duration').getAttribute('data-value')%3B%0A const durationB %3D b.querySelector('.video-item--duration').getAttribute('data-value')%3B%0A%0A %2F%2F Convert the duration strings to time in seconds for comparison%0A const timeA %3D convertDurationToSeconds(durationA)%3B%0A const timeB %3D convertDurationToSeconds(durationB)%3B%0A%0A %2F%2F Compare and return the result%0A ret
@cemerson
cemerson / skyrim-gamepad-setup-for-tk-dodge.md
Created September 19, 2023 17:27
Skyrim Gamepad Setup for TK Dodge #skyrim #gamepad

Skyrim Gamepad Setup for TK Dodge

This is mainly a note to self so I don't have to re-learn the next time I start a Skyrim run. In the end the TK Dodge should be controlled by the gamepad X button, Weapon/Sheath should be d-pad down and Stealth remains L3 click. Obviously this can be changed however if someone wants to use this approach w/a different config.

Setup

Steam Gamepad Button Changes

  • X button = Right Alt Key
  • DPad Down = R Key
  • L3 Stick Click = Left Ctrl Key