Skip to content

Instantly share code, notes, and snippets.

View klumsy's full-sized avatar

Karl Prosser klumsy

  • Pushpay Inc
  • Seattle , WA
View GitHub Profile
@klumsy
klumsy / ASM.s
Last active May 23, 2026 18:43
ReadyBASIC command example
; Signature and command IDs.
; Signature selects the resident parser shape.
; Command ID is the registry command identity.
SIG_ZADD16 = 2
CMD_ZADD16 = 2
; 32-byte descriptor macro for a command whose worker lives in LOWPACK.
; LOWPACK code is copied from REU bank $45 into the low overlay area.
.macro CMD_LOW id, sig, label, endlabel, name
.byte id, RB_CMD_F_LOW ; descriptor[0]=id, [1]=low-overlay flag
@klumsy
klumsy / ticzagtoe.zig
Last active May 22, 2026 06:34
ZAG 64 - First Example App - Tic Zag Toe
const c64 = @import("c64");
const Cell = enum(u8) { empty = 0, x = 1, o = 2 };
const Mode = enum(u8) { two_player = 0, ai = 1 };
const Outcome = enum(u8) { playing = 0, x_win = 1, o_win = 2, draw = 3, dead_draw = 4 };
const Board = struct { cells: [9]Cell };
const Game = struct {
board: Board,
moves: [9]u8,
@klumsy
klumsy / c64http.bas
Created May 7, 2026 07:23
C64U UCI HTTP BASIC EXAMPLE
10 rem c64u uci http query tester v1.6
20 print chr$(147):poke646,1:print "c64u uci http qry v1.6"
30 rem c() is command bytes, d() is uci reply bytes
40 dim c(260),d(260):dc=260
50 rem endpoint pieces: httpbin echoes query in json args
60 hn$="httpbin.org":qp$="codex=basic&uci=1"
70 pa$="/get?"+qp$:ag$="c64u-basic/1.0"
80 rem find uci, identify network target, open tcp
90 gosub 1000:if er then end
100 co=3:m$="uci base "+str$(ba):gosub 900
@klumsy
klumsy / capitalgainsslate.ps1
Created September 30, 2018 00:32
screwing around with capital gain optomization (only works with input data CSVs in specific format
Enum GainTerm {
Short
Long
}
Enum GainLoss {
Gain
Loss
}
@klumsy
klumsy / out-numbers.ps1
Last active September 16, 2018 06:01
Use Numbers on MacOS to display Powershell Data similar to Out-GridView
function Out-Numbers {
<#
.SYNOPSIS
Converts PowerShell Objects in CSV and opens in Numbers on macOS
.DESCRIPTION
Converts PowerShell Objects in CSV and opens in Numbers on macOS
TODO, maybe allow passing through a filename, an only using temp if not.
then allow certian parameters for export-csv like type, or no clobber or append..
.PARAMETER InputObject
Object to output
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class FirstdataE4Gateway < Gateway
# TransArmor support requires v11 or lower
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v11'
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v11'
TRANSACTIONS = {
sale: '00',
authorization: '01',
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class FirstdataE4V27Gateway < Gateway
self.test_url = 'https://api.demo.globalgatewaye4.firstdata.com/transaction/v27'
self.live_url = 'https://api.globalgatewaye4.firstdata.com/transaction/v27'
TRANSACTIONS = {
sale: '00',
authorization: '01',
verify: '05',
@klumsy
klumsy / PurgeRabbitQueues.ps1
Created December 5, 2014 22:16
Purge all messages in all RabbitMQ message queues.
$rabbitserver = 'localhost:15672'
$cred = Get-Credential
iwr -ContentType 'application/json' -Method Get -Credential $cred "http://${rabbitserver}/api/queues" | % {
ConvertFrom-Json $_.Content } | % { $_ } | ? { $_.messages -gt 0} | % {
iwr -method DELETE -Credential $cred -uri $("http://${rabbitserver}/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)
}
iwr -Cr $cred "http://${rabbitserver}/api/queues" | % { ConvertFrom-Json $_.Content } | % { $_ } | % {iwr -me DELETE -Cr $cred $("http://${rabbitserver}/api/queues/{0}/{1}" -f [System.Web.HttpUtility]::UrlEncode($_.vhost), $_.name)}
@klumsy
klumsy / extmethods.cs
Created September 30, 2014 20:28
random experimental extension methods
public static class Using
{
public static T Expression<T, T1>(Func<T1> createResourceLamda, Func<T1,T> work)
{
//what using statement generates in IL is equiv to this pattern
//http://msdn.microsoft.com/en-us/library/yh598w02.aspx
T1 usingResource = createResourceLamda();
try
{
return work(usingResource);
${variable:troll .....'',;;::cccllllllllllllcccc:::;;,,,''...'',,'..
..';cldkO00KXNNNNXXXKK000OOkkkkkxxxxxddoooddddddxxxxkkkkOO0XXKx:.
.':ok0KXXXNXK0kxolc:;;,,,,,,,,,,,;;,,,''''''',,''.. .'lOXKd'
.,lx00Oxl:,'............''''''................... ...,;;'. .oKXd.
.ckKKkc'...'',:::;,'.........'',;;::::;,'..........'',;;;,'.. .';;'. 'kNKc.
.:kXXk:. .. .................. .............,:c:'...;:'. .dNNx.
:0NKd, .....''',,,,''.. ',...........',,,'',,::,...,,. .dNNx.
.xXd. .:;'.. ..,' .;,. ...,,'';;'. ... .oNNo
.0K. .;. ;' '; .'...'. .oXX: