Skip to content

Instantly share code, notes, and snippets.

@tutacat
tutacat / chatgpt-confirm-close.user.js
Created September 10, 2023 16:16
Userscript to prompt when closing ChatGPT tabs.
// ==UserScript==
// @name ChatGPT Confirm Close
// @namespace gptclose
// @match https://chat.openai.com/*
// @grant none
// @version 1.03
// @author tutacat
// @license MPL
// @description 3/8/2023, 10:00:00 PM
// ==/UserScript==
@samrawal
samrawal / prompt_scratchpad.js
Last active January 15, 2024 22:09
Inline Prompt Scratchpad for ChatGPT
// Paste the following into Tampermonkey, as an Arc Boost, etc.
// See https://twitter.com/samarthrawal/status/1648867725316435973
// ==UserScript==
// @name Prompt Scratchpad for ChatGPT
// @version 0.1
// @description Collapsible prompt scratchpad for ChatGPT interface
// @namespace com.samrawal.promptscratchpad
// @author Sam Rawal and ChatGPT :)
// @match https://chat.openai.com/
@dend
dend / toast.ps1
Last active April 2, 2024 14:50
Toast Notification in PowerShell
function Show-Notification {
[cmdletbinding()]
Param (
[string]
$ToastTitle,
[string]
[parameter(ValueFromPipeline)]
$ToastText
)
@mklement0
mklement0 / Touch-File.ps1
Last active October 4, 2023 19:25
PowerShell function that provides functionality similar to the Unix touch utility for updating last-modified file timestamps and creating files on demand.
<#
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions)
License: MIT
Author: Michael Klement <mklement0@gmail.com>
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION:
irm https://gist.github.com/mklement0/82ed8e73bb1d17c5ff7b57d958db2872/raw/Touch-File.ps1 | iex
@RabaDabaDoba
RabaDabaDoba / ANSI-color-codes.h
Last active May 5, 2024 22:35 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@Desani
Desani / ScanMedia.md
Last active May 4, 2024 01:20
3.6 - Corrected issues with determining terminal size in specific use cases. Added file encoding thanks to recommendation by LordKenmou. Fixed update script checker.

This script utilizes ffmpeg, the same tool Plex uses, to decode the video stream and captures the output for any errors during playback and sends the playback errors to a log file. So essentially it plays the video in the background faster than regular speed. It then checks the error output log file to see if there is anything inside. If ffmpeg was able to cleanly play the file, it counts as a passed file. If there is any error output, an error could be anything from a container issue, a missed frame issue, media corruption or more, it counts the file as failed. So if there would be an issue with playback and a video freezing, it would be caught by this method of checking for errors. Because of the nature of the error log, any errors that show up, even simple ones, will all count as a fail and the output is captured so you can view the error log. Some simple errors are easy to fix so I have included an auto-repair feature which attempts to re-encode the file which is able to correct some issues that would cau

@Kieranties
Kieranties / Write-HostExample.ps1
Last active October 8, 2021 01:15
Write information messages in PowerShell that support colors (like Write-Host) but always honors the context `$InformationPreference variable - https://blog.kieranties.com/2018/03/26/write-information-with-colours
<#
.SYNOPSIS
A simple example of Write-Host
#>
# Displays the message
Write-Host -Object 'Hello'
# Try to silence directly
Write-Host "Still shown :-(" -InformationAction SilentlyContinue
function Lookup-Clsid
{
Param([string]$clsid)
$CLSID_KEY = 'HKLM:\SOFTWARE\Classes\CLSID'
If ( Test-Path $CLSID_KEY\$clsid) {
$name = (Get-ItemProperty -Path $CLSID_KEY\$clsid).'(default)'
$dll = (Get-ItemProperty -Path $CLSID_KEY\$clsid\InProcServer32).'(default)'
}
$name, $dll
@rkeithhill
rkeithhill / powershell.json
Last active February 23, 2024 23:18
PowerShell snippets file for Visual Studio Code - place in your ~\AppData\Roaming\Code\User\Snippets directory
{
"Condition statement": {
"prefix": "cond",
"body": [
"$1 { $0; break }"
],
"description": "Switch condition statement"
},
"Condition single quoted string statement": {
"prefix": "condsqstr",
@bcahue
bcahue / ConvertNewSteamID.markdown
Created September 24, 2014 15:04
Converting New SteamID Formats in Python

Seeing how SteamIDs have changed recently, I thought I'd write a Gist to help others (including myself!) decypher how to convert these from one format to the other in Python. First, let's go over basics to convert a 64bit CommunityID into a SteamID:

steamid64ident = 76561197960265728

def commid_to_steamid(commid):
  steamid = []
  steamid.append('STEAM_0:')
  steamidacct = int(commid) - steamid64ident