Skip to content

Instantly share code, notes, and snippets.

@ThomasHabets
ThomasHabets / gist:6da0321f6d317da253ac5fd8290c97d9
Last active March 6, 2024 22:40
What's wrong with this Rust?
/*
Aside from the panics, and the fact that the API currently requires first a call to new, then select_entry(),
how do I fix the lifetime issues:
error: lifetime may not live long enough
--> src/sigmf.rs:226:43
|
221 | pub fn select_entry(&mut self, filename: &str) -> Result<()> {
| - let's call the lifetime of this reference `'1`
...
#!/usr/bin/python3
"""
Mostly written by GPT-4 using prompt:
'Write python script to HDLC escape a packet'
"""
def hdlc_escape(packet):
FLAG_BYTE = 0x7E
ESCAPE_BYTE = 0x7D
@ThomasHabets
ThomasHabets / websocket-problem.go
Created September 18, 2020 09:31
Go gorilla/websocket program demonstrating server doesn't cancel context on connection close
package main
import (
"context"
"log"
"net/http"
"sync"
"time"
"github.com/gorilla/websocket"