Skip to content

Instantly share code, notes, and snippets.

View drazisil's full-sized avatar
💭
Always Online - Somewhere

Molly Crendraven drazisil

💭
Always Online - Somewhere
View GitHub Profile
function throwme() {
const err = new Error("foo");
err.cause = "bar";
throw err;
};
const expect = (fn) => {
const self = {};
self.fn = fn;
let thrown = false
@drazisil
drazisil / build-pdm.patch
Created August 13, 2024 11:37
fix: enable pdm to build itself for tools like pytest can find it
pyproject.toml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index c27dd99..67c08fc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -16,8 +16,9 @@ readme = "README.md"
license = {text = "MIT"}
[email protected] test
> vitest run
RUN v1.6.0 /home/drazisil/projects/probable-spoon
❯ test/connections.spec.js (1) 5009ms
❯ TCPServer (1) 5008ms
× should return an error if the port is in use 5008ms
Install Docker
Verify the `sudo egrep -c '(vmx|svm)' /proc/cpuinfo` is greater then 0
https://medium.com/axon-technologies/installing-a-windows-virtual-machine-in-a-linux-docker-container-c78e4c3f9ba1
sudo docker pull ubuntu:24.04
sudo docker run --privileged -it --name ubuntukvm --device=/dev/kvm --device=/dev/net/tun -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cap-add=NET_ADMIN --cap-add=SYS_ADMIN ubuntu:24.04 /bin/bash
error TS2209: The project root is ambiguous, but is required to resolve export map entry '.' in file '/home/drazisil/racebox/tools/database/package.json'. Supply the `rootDir` compiler option to disambiguate.
@drazisil
drazisil / bad.rs
Last active November 21, 2023 13:54
// This does not
// 1. Start by reading the encrypted session key and displaying it as an ascii string
let session_key = parsed_packet.get_encrypted_session_key();
debug!("Encrypted session key: {}", session_key);
// 2. Convert the ascii string to bytes
let session_key_bytes = hex::decode(session_key).unwrap();
export function TCPListener({
incomingSocket,
config,
log,
onSocketData = onSocketData,
onSocketError = onSocketError,
}: {
incomingSocket: ISocket;
config: TServerConfiguration;
log: TServerLogger;

Using JavaScript/JSDoc (not TypeScript), is there a way to document a class method as returning a generic type that extends a base type?

/** @extends {BaseType}
class SubType {
  /** @return {} */
  makeNew() {
    // return <T extends BaseType>
  }
}
Uncaught TypeError: log is not a function
FROM
Socket.onSocketError (file:///home/drazisil/mcos/packages/mcos-gateway/src/index.js:41:16)
Socket.emit (node:events:513:28)
Socket.emit (node:domain:489:12)
emitErrorNT (node:internal/streams/destroy:151:8)
emitErrorCloseNT (node:internal/streams/destroy:116:3)
process.processTicksAndRejections (node:internal/process/task_queues:82:21)
zsh: trace trap (core dumped)
@drazisil
drazisil / exampleActivityPubMessage.json
Last active January 17, 2023 01:57
An example ActivityPub JSON message
{
"@context": [
"https://www.w3.org/ns/activitystreams",
{
"ostatus": "http://ostatus.org#",
"atomUri": "ostatus:atomUri",
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
"conversation": "ostatus:conversation",
"sensitive": "as:sensitive",
"toot": "http://joinmastodon.org/ns#",