Skip to content

Instantly share code, notes, and snippets.

View unautre's full-sized avatar
🐳
Dockering stuff

Dylan Werner-Meier unautre

🐳
Dockering stuff
View GitHub Profile
@unautre
unautre / BlueskyFirehose.java
Created November 21, 2024 12:15
Bluesky Firehose
import java.io.InputStream;
import java.net.InetSocketAddress;
import java.net.URI;
import java.util.Map;
import com.fasterxml.jackson.databind.MappingIterator;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.cbor.databind.CBORMapper;
import java.util.Stack;
import ShuntingYard.Operators;
public class AST {
public interface Node {
public <R> R visit(Visitor<R> visitor);
};
from functools import partial
def ContractProperty(name):
return partial(Attribut, name)
class Attribut(object):
DEFAULT_ERROR_MESSAGE = "Error: contract not hold"
def __init__(self, name, fset=None, fget=None, fdel=None, doc=None, contracts=None):
self._name = name
# list of predicates/contracts it should hold
@unautre
unautre / ipc.py
Created June 10, 2014 12:32
Simple IPC Message Queue class for Python3, using ctypes and libc.
from ctypes import CDLL, get_errno, create_string_buffer
from ctypes import c_ushort, c_int, c_uint, c_long, c_ulong
from ctypes import c_char_p, c_void_p, POINTER, Structure, cast
# we load the libc.
libc = CDLL("libc.so.6")
# define some consts.
IPC_CREAT = 0o1000
IPC_EXCL = 0o2000
IPC_NOWAIT= 0o4000