Skip to content

Instantly share code, notes, and snippets.

View solrevdev's full-sized avatar
💭
🤓

John Smith solrevdev

💭
🤓
View GitHub Profile
@solrevdev
solrevdev / update.ps1
Created March 6, 2024 09:55
update.ps1 - a script that i use on windows servers to keep tooling up to date
#!/usr/bin/env pwsh
Write-Output "Updates starting at $(Get-Date)"
scoop update
choco upgrade all -y
# Update .NET tools
$tools = dotnet tool list -g | Select-Object -Skip 2
foreach ($row in $tools) {
@solrevdev
solrevdev / Preferences.sublime-settings
Created January 18, 2024 17:39
Preferences.sublime-settings for sublime text 4. Changes from light/dark and includes my current font faves etc
// https://chat.openai.com/c/9cdb2c85-b607-4e5c-a9ae-02f8bd9b3970
{
"font_face" : "IntelOne Mono",
"font_size" : 15,
"font_options" : ["ss01"],
"font_family" : "'IntelOne Mono','CaskaydiaCove Nerd Font','JetBrains Mono',Monaco, 'Anonymous Pro','Liberation Mono', SFMono-Regular, Consolas, 'Dank Mono','Fira Code','Source Code Pro', Menlo, Monaco, 'Courier New', monospace",
"theme": "Adaptive.sublime-theme", // Make sure this theme supports light and dark modes
"color_scheme": "auto", // This will switch color schemes based on system settings
"ignored_packages": ["Vintage"],
"dictionary": "Packages/Language - English/en_GB.dic",
@solrevdev
solrevdev / archive-all-chatgpt-chats.js
Created December 22, 2023 09:54 — forked from aomarks/archive-all-chatgpt-chats.js
Archive all ChatGPT chats browser script
// This script will iterate over all of your ChatGPT sessions and archive them one-by-one.
//
// 1. Go to https://chat.openai.com/
// 2. Open Chrome devtools (see https://developer.chrome.com/docs/devtools/open) or equivalent in your browser
// 3. Open the console tab
// 4. Paste the code below and press enter
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const history = document.querySelector('[aria-label="Chat history"]');
while (true) {
@solrevdev
solrevdev / Microsoft.PowerShell_profile.ps1
Created December 17, 2023 12:01
/Users/solrevdev/.config/powershell/Microsoft.PowerShell_profile.ps1
# https://chat.openai.com/c/1422db25-ebe5-4964-be64-0ea089c2842c
# Determine the architecture of the macOS machine
if ($env:OS -eq "Windows_NT") {
# Windows Subsystem for Linux interoperability, if needed
# Set environment variables for WSL
} else {
# Default to Intel paths
$brewPrefix = "/usr/local"
$brewCellar = "/usr/local/Cellar"
$brewRepository = "/usr/local/Homebrew"
@solrevdev
solrevdev / Microsoft.VSCode_profile.ps1
Created December 17, 2023 12:01
/Users/solrevdev/.config/powershell/Microsoft.VSCode_profile.ps1
# https://chat.openai.com/c/1422db25-ebe5-4964-be64-0ea089c2842c
# Determine the architecture of the macOS machine
if ($env:OS -eq "Windows_NT") {
# Windows Subsystem for Linux interoperability, if needed
# Set environment variables for WSL
} else {
# Default to Intel paths
$brewPrefix = "/usr/local"
$brewCellar = "/usr/local/Cellar"
$brewRepository = "/usr/local/Homebrew"
@solrevdev
solrevdev / dont-fuck-with-paste.js
Created November 14, 2023 13:07
When sites try to block you from pasting data into fields. Stop them. allow paste!
var allowPaste = function(e){
e.stopImmediatePropagation();
return true;
};
document.addEventListener('paste', allowPaste, true);
// see
// https://www.cyberciti.biz/linux-news/google-chrome-extension-to-removes-password-paste-blocking-on-website/
// also see
@solrevdev
solrevdev / subl-error-fix.md
Last active October 17, 2023 13:16
sublime on MacBook air issue

Thanks to the following GitHub comment for this fix:

Package Control will be uppraded next time package update is triggered, either by automatic updates at ST startup or by manually calling "Package Control: Upgrade All Packages/Overwrite All" via Command Palette.

In case PC3.x is not working, you can

- download https://github.com/wbond/package_control/releases/download/4.0.0-beta2/Package.Control.sublime-package
- call Main Menu > Preferences > Browse Packages...
- navigate to to ../Installed Packages
@solrevdev
solrevdev / empty-git-commit.sh
Last active August 21, 2023 12:00
A blank empty git commit - generally used for testing ci etc.
# macos single chars are fine
git commit --allow-empty -m 'ci: empty commit for pr [skip ci]'
# windows needs double chars
git commit --allow-empty -m "ci: empty commit for pr [skip ci]"
@solrevdev
solrevdev / HttpContextExtensions.cs
Last active August 16, 2023 10:46
Map Physical Paths with an HttpContext.MapPath() Extension Method in ASP.NET (via By Rick Strahl)
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using System;
using System.IO;
/// <summary>
/// Provides extension methods for the HttpContext class.
/// </summary>
public static class HttpContextExtensions
@solrevdev
solrevdev / DotnetAndProductVersion.cs
Created July 21, 2023 11:04
How to get the running .NET version and also the current Product version via <Version> element in csproj
using System;
using System.Reflection;
var dotnetVersion = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
Console.WriteLine($"🌄 .NET Version: {dotnetVersion}");
var productVersion = Assembly.GetEntryAssembly().GetCustomAttribute<System.Reflection.AssemblyInformationalVersionAttribute>().InformationalVersion;
Console.WriteLine($"🌄 Product Version : {productVersion}");