Skip to content

Instantly share code, notes, and snippets.

View AstraLuma's full-sized avatar
🐍
snek snek snek snek

Jamie Bliss AstraLuma

🐍
snek snek snek snek
View GitHub Profile
@AstraLuma
AstraLuma / proto.md
Created February 8, 2020 06:36
Untitled RPC Protocol

(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 January 26, 2020 03:42
buildahscript proof of concept
#!/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 January 8, 2020 04:36
Podman Varlink Networking Tests
import contextlib
import json
import os.path
import subprocess
import tempfile
import time
from varlink import Client
IMG = "quay.io/libpod/alpine_nginx:latest"
#!/usr/bin/python3
import enum
import dataclasses
import struct
import asyncio
import weakref
class InvalidPacket(Exception):
"""
@AstraLuma
AstraLuma / README.md
Last active August 28, 2019 19:14
Importable GraphQL

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 August 5, 2019 02:55
How to make a chrome "app"
@AstraLuma
AstraLuma / 99-phonebackup.rules
Created March 16, 2019 18:25
Automatic Phone Backup (via udev and systemd)
ACTION=="add", ENV{ID_SERIAL}=="*?", RUN+="/home/astraluma/udev-handler"
import collections.abc
import pathlib
__all__ = ('root',)
class AttrsView(collections.abc.KeysView):
def __init__(self, root):
self._root = pathlib.Path(root)
@AstraLuma
AstraLuma / fails1.py
Created March 13, 2019 20:55
Gio Weirdness
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)
@AstraLuma
AstraLuma / README.md
Last active December 10, 2018 01:52
Python Async+SSH

Proof of Concept of using Python+Async to connect to a server over SSH.

Requires:

  • Python >= 3.6
  • msgpack
  • tornado<5

Run client.py, assumes you're running ssh-server on localhost and that you can log in to it.