Skip to content

Instantly share code, notes, and snippets.

Avatar
🐍
snek snek snek snek

Jamie Bliss AstraLuma

🐍
snek snek snek snek
View GitHub Profile
View mtpd.py
#!/usr/bin/env python3
"""
Launches and manages uMTP-Responder with better cleanup.
"""
import contextlib
import os
from pathlib import Path
import subprocess
import tempfile
import time
@AstraLuma
AstraLuma / proto.md
Created Feb 8, 2020
Untitled RPC Protocol
View proto.md

(Unnamed RPC Protocol)

  • Pulls a bunch of ideals from varlink
  • Encoded as two msgpack streams, one in each direction
  • The stream is broken up into channels, where there is a single call and potentially many responses.
  • Method names are forward-dotted paths (eg com.foobar.service.Method)
  • Parameters and returns are both maps; at the application level, methods only take keyword arguments and return named return values
  • Methods may return 0 or more returns or errors
@AstraLuma
AstraLuma / server-build.py
Last active Jan 26, 2020
buildahscript proof of concept
View server-build.py
#!/usr/bin/env buildahscript
#| pip: requests
#| arg: eula: bool
#| arg: version: str = "latest"
#| arg: type: str = "vanilla"
with TemporaryDirectory() as td:
bin = td / 'bin'
bin.mkdir()
with workspace('rust:buster') as build:
@AstraLuma
AstraLuma / test.py
Created Jan 8, 2020
Podman Varlink Networking Tests
View test.py
import contextlib
import json
import os.path
import subprocess
import tempfile
import time
from varlink import Client
IMG = "quay.io/libpod/alpine_nginx:latest"
View rcon-test.py
#!/usr/bin/python3
import enum
import dataclasses
import struct
import asyncio
import weakref
class InvalidPacket(Exception):
"""
@AstraLuma
AstraLuma / README.md
Last active Aug 28, 2019
Importable GraphQL
View README.md

The basic idea: Define GraphQL queries as importable modules.

For example:

# queries.gql
#!starwars

query HeroForEpisode($ep: Episode!) {
  hero(episode: $ep) {
@AstraLuma
AstraLuma / README.md
Last active Aug 5, 2019
How to make a chrome "app"
View README.md
@AstraLuma
AstraLuma / 99-phonebackup.rules
Created Mar 16, 2019
Automatic Phone Backup (via udev and systemd)
View 99-phonebackup.rules
ACTION=="add", ENV{ID_SERIAL}=="*?", RUN+="/home/astraluma/udev-handler"
View sysfs.py
import collections.abc
import pathlib
__all__ = ('root',)
class AttrsView(collections.abc.KeysView):
def __init__(self, root):
self._root = pathlib.Path(root)
View fails1.py
import functools
from gi.repository import GObject
from gi.repository import Gio
from gi.repository import GLib
def runloop(func):
@functools.wraps(func)
def wrapped(*pargs, **kwargs):
func(None)
You can’t perform that action at this time.