Skip to content

Instantly share code, notes, and snippets.

@ttscoff
ttscoff / ripple.rb
Last active July 11, 2025 21:43
A command line tool (and library) for creating a ripple effect on text, for progress animation
#!/usr/bin/env ruby
# frozen_string_literal: true
# ripple - A simple Ruby script to create a text ripple effect in the terminal.
## From the command line, you can run:
# $ ruby ripple "Your Text Here" --speed fast --rainbow --direction bidirectional
## Run a command during the animation:
# $ ruby ripple "Your Text Here" --speed fast --rainbow --direction bidirectional --command "sleep 5"
# This will animate the text "Your Text Here" with the specified options, and run the command in the background.
@pmarreck
pmarreck / please.bash
Last active February 6, 2025 18:45
"please"- a bash function to ask an LLM to compose and run a bash command, with an approval/denial step
needs() {
command -v "$1" > /dev/null || { >&2 printf "%s is required- not installed or in PATH; %s\n" "$1" "${@:2}"; return 1; }
}
_generate_curl_api_request_for_please() {
needs jq;
local request args timeout model curl;
local curl=${CURL:-curl};
local model=${OPENAI_MODEL:-gpt-4o};
local timeout=${OPENAI_TIMEOUT:-30};
@rmtbb
rmtbb / ChatGPT Canvas HTML Renderer from Clipboard.url
Last active July 5, 2025 17:49
Bookmarklet that lets you render a full HTML page with any included css and javascript that is currently copied to your clipboard. Also works for SVG code. Useful with ChatGPT Canvas
javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard
@CFiggers
CFiggers / keychords.ahk
Last active November 11, 2024 23:30
Keychords in Autohotkey
; Tested and working using AutoHotkey v1.1.33.09
awaitKeypress(){
ih := InputHook()
ih.KeyOpt("{All}", "ES") ; End and Suppress
; Exclude the modifiers
ih.KeyOpt("{LCtrl}{RCtrl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}", "-ES")
ih.Start()
ErrorLevel := ih.Wait() ; Store EndReason in ErrorLevel
result := ih.EndMods . ih.EndKey
@mbikovitsky
mbikovitsky / killbutmakeitlooklikeanaccident.bat
Last active April 28, 2025 15:49 — forked from moyix/killbutmakeitlooklikeanaccident.sh
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
@"C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe" -sins -y "srv*nul" -c "r rip = ntdll!NtTerminateProcess; r rcx = -1; r rdx = 0; r rsp = (@rsp & 0xFFFFFFFFFFFFFFF0) - 8; eq @rsp (-1); qd" -p %1
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@prologic
prologic / LearnGoIn5mins.md
Last active July 10, 2025 04:38
Learn Go in ~5mins
@idelem
idelem / titleUrlMarkdownClip.js
Last active May 31, 2025 01:01 — forked from bradleybossard/titleUrlMarkdownClip.js
Bookmarklet to copy current page title and url in Markdown format to clipboard, like [title](url) - Usual for posting links to resources in README.md files
javascript:(function() {
function copyToClipboard(text) {
if (window.clipboardData && window.clipboardData.setData) {
/*IE specific code path to prevent textarea being shown while dialog is visible.*/
return clipboardData.setData("Text", text);
} else if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
var textarea = document.createElement("textarea");
textarea.textContent = text;
@natrys
natrys / miracle.pi
Created May 20, 2020 23:00
Solving "Miracle" Sudoku in Picat
λ picat miracle.pi
CPU time 0.034 seconds. Backtracks: 0
{4,8,3,7,2,6,1,5,9}
{7,2,6,1,5,9,4,8,3}
{1,5,9,4,8,3,7,2,6}
{8,3,7,2,6,1,5,9,4}
{2,6,1,5,9,4,8,3,7}
{5,9,4,8,3,7,2,6,1}
#!/usr/bin/env python3
import z3
import pprint
# 9x9 matrix of integer variables
X = [ [ z3.Int("x_%s_%s" % (i+1, j+1)) for j in range(9) ]
for i in range(9) ]
# each cell contains a value in {1, ..., 9}
cells_c = [ z3.And(1 <= X[i][j], X[i][j] <= 9)