Skip to content

Instantly share code, notes, and snippets.

View akaihola's full-sized avatar
🌇
Working from home

Antti Kaihola akaihola

🌇
Working from home
  • Wärtsilä Oyj
  • Espoo, Finland
View GitHub Profile
@akaihola
akaihola / nixos-x1.rst
Last active April 6, 2024 20:28
Installing NixOS on a Lenovo ThinkPad Carbon X1 Gen 9

Installing NixOS on a Lenovo ThinkPad Carbon X1 Gen 9

Installation media

  • Downloaded nixos-21.11/latest-nixos-gnome-x86_64-linux.iso__ from channels.nixos.org__.
  • NixOS manual instructs to create the USB stick using dd
@akaihola
akaihola / endpoints.txt
Created July 30, 2023 16:52
Reverse engineering Yamaha/Bösendorfer Enspire Pro server structure
GET http://192.168.1.81/ctrl/master.json
GET http://192.168.1.81/ctrl/settings.json
GET http://192.168.1.81/ctrl/performance.json
GET http://192.168.1.81/ctrl/performance.html?ver=5.02.00
GET http://192.168.1.81/ctrl/getContentURL.php
@akaihola
akaihola / Teewasser.ipynb
Last active July 30, 2023 16:49
Plot Joeveo mug water temperature cooling as a function of time
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@akaihola
akaihola / .gitignore
Last active June 1, 2023 12:30
streaming-json-encoder
*.pyc
/bin
/include
/lib
@akaihola
akaihola / cov_to_lint.py
Last active March 9, 2022 15:58
Script for converting coverage.py XML output into lint-style output
#!/usr/bin/env python
"""Script for converting ``.coverage`` SQLite output into lint-style output
The output is suitable for consumption using Darker.
See https://github.com/akaihola/darker
Example usage, pointing out modified code in a feature branch not covered by
the test suite::
@akaihola
akaihola / README.rst
Created December 21, 2011 08:30
django-full-email

Full e-mail address validation for Django

Out of the box, Django e-mail fields for both database models and forms only accept plain e-mail addresses. For example, joe@hacker.com is accepted.

On the other hand, full e-mail addresses which include a human-readable name, for example the following address fails validation in Django:

@akaihola
akaihola / LICENSE.txt
Last active December 18, 2021 23:23
XML pretty-print for ElementTree
Copyright (c) 2013, Antti Kaihola
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
@akaihola
akaihola / userdata.yaml
Created December 18, 2020 18:54
CrewLink-server cloud-init for Ubuntu
#cloud-config
# Start an Ubuntu server with this cloud-init data to run a
# CrewLink-server instance and update its IP for a subdomain. The
# domain name must be hosted at Gandi LiveDNS.
#
# Near the bottom of the page, replace these strings with your data:
# - your Gandi API key
# - your-domain.tld
# - your-subdomain
@akaihola
akaihola / README.txt
Created December 9, 2010 10:20
Many-to-many checkbox formsets for Django
Many-to-many formsets for Django
@akaihola
akaihola / tee_stream_head.py
Last active May 31, 2018 20:02
Split a non-seekable stream into a header reader and a content reader
import io
from typing import Tuple
def tee_stream_head(stream: io.IOBase,
head_max_lines: int=3) -> Tuple[io.RawIOBase,
io.RawIOBase]:
"""Split a stream, enable parallel reading of initial lines
This helper solves the use case where a limited number of initial lines