Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am catern on github.
  • I am sbaugh (https://keybase.io/sbaugh) on keybase.
  • I have a public key ASC7jDWM5X4FM04OpqJWA6j0xgAYbN3PdZTVxYWKJGlnbAo

To claim this, I am signing this object:

import subprocess
import json
import functools
nix_tarball_drv = "/nix/store/h0m0794x8d02hyrwkby3asajnz2s2g6n-nix-1.11.15.tar.xz.drv"
@functools.lru_cache()
def load_derivation(drv):
data = subprocess.check_output(['nix', 'show-derivation', drv]).decode()
return json.loads(data)[drv]
from setuptools import setup
setup(name='supervise_api',
version='0.1.5',
description='An API for running processes safely and securely',
long_description=("This package uses the supervise utility, a separately-available C binary,"
" to provide a better process API for Linux."),
classifiers=[
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: POSIX :: Linux",
with (import <nixpkgs>) {};
runCommand "blargh" {}
''
cat /etc/passwd > $out
''
def run_foo(a, b, c, readiness_callback):
frobnicate(a)
massage(b)
fun = perambulate(a + b + c)
proc = start_process("fooer", fun, a, b)
obj = FooInterface(a, b)
readiness_callback(obj) # fooer is started and ready now for requests
return proc.wait_for_exit_and_return_exit_code()
import os
from typing import Callable, Any
class Callcc:
"""The awaitable class that callcc returns
The bulk of the work here is done by trampoline created by the
start() function. We just yield up the callback, and the
trampoline actually does the call.
def start(coroutine):
"""Starts a coroutine running.
If the coroutine makes a blocking call before yielding for the
first time, start() will block. However, if the coroutine is
written to not use blocking operations, or at least doesn't call
them before its first yield, start() will return immediately
(after reaching the first yield).
In either case, this function will return None.
def start(coroutine):
"""Starts a coroutine running.
If the coroutine makes a blocking call before yielding for the
first time, start() will block. However, if the coroutine is
written to not use blocking operations, or at least doesn't call
them before its first yield, start() will return immediately
(after reaching the first yield).
In either case, this function will return None.
def start(coroutine):
"""Starts a coroutine running.
If the coroutine makes a blocking call before yielding for the
first time, start() will block. However, if the coroutine is
written to not use blocking operations, or at least doesn't call
them before its first yield, start() will return immediately
(after reaching the first yield).
In either case, this function will return None.
def start(coroutine):
"""Starts a coroutine running.
If the coroutine makes a blocking call before yielding for the
first time, start() will block. However, if the coroutine is
written to not use blocking operations, or at least doesn't call
them before its first yield, start() will return immediately
(after reaching the first yield).
In either case, this function will return None.