Skip to content

Instantly share code, notes, and snippets.

@cemerson
cemerson / sql-database-onlineoffline-readonly-queries.sql
Created February 14, 2025 10:55
sql-database-onlineoffline-readonly-queries.sql
-- ALTER DATABASE MyDB SET READ_WRITE;
ALTER DATABASE MyDB SET OFFLINE WITH ROLLBACK IMMEDIATE;
@cemerson
cemerson / days-gone-what-it-takes-horde-spawn-fix-no-restart.md
Last active January 26, 2025 12:46
Days Gone: Fix What It Takes To Survive Horde Spawn Bug Without Restarting Mission (1/2025)

Fix Horde Spawn Bug in 'What it Takes to Survive' Days Gone Mission WITHOUT restarting mission **

NOTE: requires mods, ability to manage zip files and (temporary) cheat mod. | Works as of Jan 2025

I ran into this issue in Jan 2025 and was first real problem I've had w/game. I read all the posts saying you had to restart (the game application itself and the entire mission) to fix the mission bug where the horde never spawns. I was going to be super pissed if I had to do this so I found a way to avoid it. Do everything below at your own risk, etc etc - but it worked for me.

Requirements for success

A) You ran into the mission bug where horde doesn't spawn B) You have no closed your game or restarted mission yet C) You killedthe Reacher guy already D) You know how to zip files, backup files etc

@cemerson
cemerson / minecraft-apotheosis-library-of-alexandria-setup.md
Created January 5, 2025 11:49
Bookshelf Setup for getting Library of Alexandria in Minecraft Apotheosis mod

Minecraft: Bookshelf Setup for getting Library of Alexandria (#Apotheosis)

After trying many different setups I finally got my shelves to allow infusing the Enchantment Library to get the Library of Alexandria w/the following setup:

  [01][02][03][04][05]
  [06]            [07]
  [08]            [09]
  [10]            [11]
  [12][13][14][15][16]
@cemerson
cemerson / curricula-video-training-speed-up.js
Last active December 9, 2024 19:37
curricula-video-training-speed-up.js
var videoPlayers = document.querySelectorAll("video");
for(v=0;v<videoPlayers.length;v++) videoPlayers[v].playbackRate = 1.65;
@cemerson
cemerson / git-fix-dev-branch-local-ai-20241205.md
Created December 5, 2024 18:56
Git - fix local dev branch out of sync with remote

resolving issue where local development branch is out of sync has odd/new merge issues not on remote/azure/github ...

To reset your local development branch to match the remote branch from Azure DevOps (or any remote repository), you can use the following steps. This will overwrite your local branch completely with the latest version from the remote.

Steps to Reset development to Match Remote:

  1. Switch to the development branch:

git checkout development

@cemerson
cemerson / sql-try-catch-transaction-block-template.sql
Created October 22, 2024 14:42
SQL try catch transaction block template
BEGIN TRY
BEGIN TRANSACTION
-- DO STUFF
ROLLBACK TRANSACTION --ROLLBACK COMMIT
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
BEGIN
ROLLBACK TRANSACTION
END
@cemerson
cemerson / sfdx-authorize-an-org-notes-2024101x.md
Last active October 14, 2024 12:59
SFDX Authorize an Org Issues (notes)

SFDC Authorize an Org Issues

Getting sfdx "Authorize an Org" to work is very hit/miss depending on your luck/setup/etc. This is mainly just a note to myself that when you're on the last part of the auth process where you're at a locahost URL post SFDC login and you get a ERR_CONNECTION REFUSED or other error, try changing the port in the URL to 7717 or 7177 and maybe it will work. This assumes MS Defender/etc have proper firewall rules/exeptions etc in place.

Related Errors/Strings

(mostly here just for metadata/search indexing)

  • ERR_CONNECTION_REFUSED
  • OauthRedirect
  • sfdx force:auth:web:login -a
@cemerson
cemerson / sublime-text-obfuscate-mangle-private-html-content-user-plugin.md
Last active September 11, 2024 10:32
Sublime Text: Obfuscate/Mangle Private HTML Content (User Plugin)

Summary

  • I needed something to clean my HTML content when using in public/AI sources
  • I initially tried Sublime Text's "macros" but they apparently can't do search/replace which is insane (imo)
  • Finally got a Sublime Text "plugin" version working - it took bit of time to hash out because all online sources (including/especially AI) were wrong and gave back/non-functioning code.
  • Sharing in case others find useful.

Important

Camel Case Command

The command in the py file * * MUST * * be exactly camel case like this or it will silently fail and never show up in the cmd palette: If the file name is my_cool_plugin.py the PY class def should be like: MyCoolPluginCommand. So:

@cemerson
cemerson / tsql-run-stored-procedure-on-multiple-ids-deletion-example.sql
Created August 19, 2024 12:37
TSQL: Run stored procedure on multiple IDs (deletion example)
BEGIN TRANSACTION
DECLARE @reviewMode int = '0';
DECLARE @password nvarchar(max) = 'password_here';
DECLARE @testStudyIDList NVARCHAR(MAX) = '2791,2793,2843,2844';
DECLARE @testStudyID NVARCHAR(4000);
DECLARE @TestStudyIDTable TABLE (ID NVARCHAR(4000));
INSERT INTO @TestStudyIDTable(ID)
SELECT Data FROM dbo.Split(@testStudyIDList, ',');
@cemerson
cemerson / csharp-get-exception-details-in-html.cs
Last active July 18, 2024 13:22
Get C# Exception Details String (HTML)
/* ---------- Usage ----------------------------------
string exceptionDetailsHtml = ExceptionHelper.GetExceptionDetailsInNicelyFormatted(ex, "HTML");
Console.WriteLine(exceptionDetailsHtml);
string exceptionDetailsText = ExceptionHelper.GetExceptionDetailsInNicelyFormatted(ex, "TEXT");
Console.WriteLine(exceptionDetailsText);
// ---------------------------------------------------- */
public static class ExceptionHelper
{
public static string GetExceptionDetailsInNicelyFormatted(Exception ex, string displayFormat = "TEXT")