Skip to content

Instantly share code, notes, and snippets.

@fedej
fedej / Dockerfile
Created November 1, 2022 19:38
cross-compiling python3.11 for Raspberry pi 1
FROM debian:bullseye-slim as base
RUN apt update && apt install -y git make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
RUN curl https://pyenv.run | bash
RUN $HOME/.pyenv/bin/pyenv install 3.11.0
FROM dockcross/linux-armv6-lts
COPY --from=base /root/.pyenv /root/.pyenv
@fedej
fedej / Dockerfile
Created April 24, 2022 21:17
gRPC-web with nginx proxy
FROM node:16.14.2-alpine3.15 as client-builder
RUN apk update
RUN apk add git protoc
RUN mkdir /grpc
WORKDIR /grpc
RUN git clone -b 1.3.1 https://github.com/grpc/grpc-web
WORKDIR /grpc/grpc-web/net/grpc/gateway/examples/helloworld
RUN npm install
RUN wget -O /usr/local/bin/protoc-gen-grpc-web https://github.com/grpc/grpc-web/releases/download/1.3.1/protoc-gen-grpc-web-1.3.1-linux-x86_64
@fedej
fedej / context_var_demon.py
Last active August 4, 2021 00:54
Context var isolation test
import asyncio
import time
from contextvars import ContextVar
from typing import Optional
TOKEN: ContextVar[Optional[str]] = ContextVar("token", default=None)
class Lock:
def __init__(self, name):
@fedej
fedej / ffmpeg.py
Created May 4, 2020 00:13
asyncio ffmpeg-python
import json
from ffmpeg._run import Error, compile
from ffmpeg._utils import convert_kwargs_to_cmd_line_args
from asyncio import create_subprocess_exec, subprocess, wait_for
async def probe(filename, cmd='ffprobe', timeout=None, **kwargs):
args = [cmd, '-show_format', '-show_streams', '-of', 'json']
args += convert_kwargs_to_cmd_line_args(kwargs)