Skip to content

Instantly share code, notes, and snippets.

@stereosteve
stereosteve / so_much_to_say.rb
Created August 29, 2024 15:46
So Much To Say
use_bpm 110
hits = "/Users/steve/code/so_much_to_say/samples/"
voices = File.readlines("/Users/steve/code/so_much_to_say/voices.txt").map {|line| line.chomp}
words = %w(so much to say)
puts "hello!!!!!"
import * as secp from "@noble/secp256k1"
import { blake3 } from "@noble/hashes/blake3"
import canonicalize from "canonicalize"
import { Address } from "micro-eth-signer"
import { base58, base64 } from "@scure/base"
// enables sync mode
import { hmac } from "@noble/hashes/hmac"
import { sha256 } from "@noble/hashes/sha256"
secp.etc.hmacSha256Sync = (k, ...m) =>

Anonymous code block:

DO $$
BEGIN

  raise notice 'hello world';

END; $$;
-- currently running queries (youngest to oldest)
SELECT pid, state, age(clock_timestamp(), query_start), substring(trim(regexp_replace(query, '\s+', ' ', 'g')) from 1 for 200)
FROM pg_stat_activity
WHERE state != 'idle' AND query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- x blocking y
@stereosteve
stereosteve / Chatroom.tsx
Last active April 21, 2025 23:08
React hooks for using nats.ws
// A very basic chatroom example:
import { JSONCodec, Msg } from 'nats.ws'
import { FormEvent, useState } from 'react'
import './App.css'
import { useNats, useNatsSubscription } from './useNats'
const natsSubject = 'chat'
const sc = JSONCodec()
import {
serve,
ServerRequest,
} from "https://deno.land/[email protected]/http/server.ts";
const GIT_PROJECT_ROOT = "repoz";
const encoder = new TextEncoder();
async function gitCgi(request: ServerRequest) {
let [path, query] = request.url.split("?");
use std::io::{self, BufRead};
fn to_mark(i: u8) -> String {
match i {
1 => "X".to_string(),
2 => "O".to_string(),
_ => "-".to_string(),
}
}
const std = @import("std");
const Mark = enum(u2) {
Empty,
X,
O,
};
const Game = struct {
board: [3][3]Mark,
@stereosteve
stereosteve / react_debug.jsx
Created September 17, 2014 17:37
React debug component
var Debug = React.createClass({
render: function() {
var obj = this.props.obj
var json = JSON.stringify(obj, undefined, 2)
return <pre>{json}</pre>
}
})
.long-shadow {
text-shadow:
1px 1px #333,
2px 2px #333,
3px 3px #333,
4px 4px #333,
5px 5px #333;
}