Skip to content

Instantly share code, notes, and snippets.

@rjw57
rjw57 / Dockerfile
Last active February 6, 2024 14:22
Installing pypy3 and numpy from scratch on Debian 10
# This Dockefile demonstrates how to install upstream pypy3 on a bare Debian 10
# box from scratch.
#
# To test:
# docker run --rm rjw57/pypy3 \
# pypy3 -c 'import numpy as np; M=np.array(range(16)).reshape((4,-1)); Q, R = np.linalg.qr(M); [print(x) for x in (M, Q, R, np.dot(Q,R))]'
FROM debian:10
# Install any system-wide dependencies we need including essential packages
# required to compile C-based Python modules.
@rjw57
rjw57 / friendly_hostname.py
Last active September 13, 2018 11:08
Ansible filter plugin to generate deterministic docker-style "friendly hostnames" for a server
# coding=utf8
"""
A plugin which contains a custom Ansible filter named "friendly_hostname"
which takes a string and generates a deterministic human-readable hostname
with a low chance of collision.
The generated hostname has around 24 bits of entropy which is probably OK up to
a few hundred hosts. See: https://en.wikipedia.org/wiki/Birthday_attack
This module may be run via "python -m friendly_hostname" to test the generator.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// Inputs:
// D4 (T0) - Char clock
// Outputs
// D3 (OC2B) - VSYNC
// D5 (OC0B) - HSYNC
// D10 (OC1B) - Visible
//
// All outputs should be synchronised to the rising edge of char clock
@rjw57
rjw57 / julia-example.ipynb
Last active May 10, 2017 11:33
Julia Mandlebrot SenseHat example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
"""
Track observations outputted by reproject-obs.py
Usage:
track-reproj-observations.py [options] <observations> <output>
Options:
--max-frame=FRAME Only process up to frame FRAME.