Skip to content

Instantly share code, notes, and snippets.

View emlun's full-sized avatar

Emil Lundberg emlun

View GitHub Profile
@emlun
emlun / asn1-indent.py
Created June 9, 2023 11:23
Indent ASN.1 DER in hex
#!/usr/bin/env python3
import sys
from typing import Tuple
def is_container(value: bytes) -> bool:
return len(value) > 0 and value[0] in {0x30, 0x31}
@emlun
emlun / blueprint.txt
Created June 27, 2020 16:52
Factorio: Marathon red circuits 179.2/s
0eNrsvduOXUmSpvcqBV6OGC0/HwozA/Q0IN30hSAIqItGIsEkIzMDTTKIIFmaUiMfYN5DerF5Eu0dQUYsbndb6//NFjeZjLjp6iQ3zdzNT+a2zD7/j2e/vP54+e7m6u2HZ3/9j2dXL6/fvn/213/7j2fvr357++L18c8+/OPd5bO/Prv6cPnm2fNnb1+8Of7Xi1d/f/H25eWri5dXNy8/Xn149sfzZ1dvX13+92d/9X/89PzZ5dsPVx+uLu9k3f7HP35++/HNL5c3hx/cS3n/4ebF1W+/f7g4/M/rg/B31+8P/+r67VHtQdKF9+H5s3/c/j/pjz+eD5ICLsmVVUnxXtLLjzd/P/RLkNPzZzHx0ONXVzeXL+/+Ok2EJrh5fb11GRfkVgUVsJstCt2sE6EVE9q8IDNMZLZ7mUdhF59m4yCz1n96GJB/yttyO2rJnlYN6R3Wae+kCeNnUuGl4d1G+4JmkYWpqKhZZXNRmhUxl5S/nCAvf39x9VacJhc9PMwTfzpP4kx+USy5eUsr1dLWVlo622R8g1ta20NLN1eK77jcQsgNDpebGLn4sVIDIxdfSdUxcvFlVZhxC/gaK9S44YdQocYNX2mFGreKy6XGDV9vmRo3fL1lZtwivt4yM24RX2+ZGbeIr7fMjFvE11tixi3i6y1R44avt0SNG77eEjVu+HpL1Ljh6y1S44avt8iMW8LXW2TGLeHrLTLjlvD1FplxS/h6C8y4JXy9BWrc8PUWqHHD11ugxg1fb4EaN3y9eWrc8PXmmXHL+HrzzLhlIkzBjFtmghaMXHy9McOWCXeSEUucboxYYrExYuG1Ro0YvNKotsLrjDFsgVcZMwsKvMaYKVsCHkVhxMILjNoPCrzAqO2rwAuM2m0LvMCow6HAC4w6ywq+wqghg5cY5SlUeI1Rjk2FFxnlh1V4lVFuY4VXGeXlVniVUU55hVcZdYeo8CqjrjwVXmXUDa3Cq4y6UFb8IGOGrMGrjLquN3iVUdGFBq8yKhjS4FVGxW4avMq
@emlun
emlun / README.md
Last active February 20, 2020 15:19
DRAFT: WebAuthn recovery credentials extension
@emlun
emlun / README.md
Last active July 15, 2019 21:00
Factorio: Speed vs productivity modules visualisation
// Copyright (c) 2018, Yubico AB
// 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 notice,
@emlun
emlun / extension.md
Created October 22, 2018 08:17
Draft: WebAuthn recovery extension

DRAFT: Recovery Credentials Extension (recovery)

This extension allows for recovery credentials to be registered with an RP, which can be used for account recovery in the case of a lost/destroyed main authenticator. This is done by associating one or more backup authenticators with the main authenticator, the latter of which is then able to provide additional credentials for account recovery to the RP without involving the backup authenticators. The mechanism of setting this up is outside of the scope of this extension, however a state counter is defined as follows:

@emlun
emlun / pngen.py
Last active October 10, 2017 10:33
#!/usr/bin/python3
# Tiny tool for generating valid but nonsensical PNG images of a given file size.
#
# Usage:
#
# $ python pngen.py SIZE_BYTES
#
# Example:
#
# $ python pngen.py 1024 > output.png
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<script>
const ykNanoCredentialId = new Uint8Array([
177, 125, 44, 11, 125, 20, 124, 221, 117, 42, 171, 163, 91, 125, 150, 85,
217, 150, 76, 209, 3, 91, 109, 115, 21, 100, 42, 36, 107, 73, 20, 120,
@emlun
emlun / c173434232651982.lua
Last active September 9, 2017 19:48
Shenzhen I/O: Frobnicator
-- The function get_name() should return a single string that is the name of the puzzle.
--
function get_name()
return "Frobnicator"
end
-- The function get_description() should return an array of strings, where each string is
-- a line of description for the puzzle. Surrounding text with asterisks will cause it to
-- be rendered in bold, something we use when mentioning a signal by name.
--
#!/usr/bin/python3
from binascii import hexlify, unhexlify
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
sig_alg = ec.ECDSA(hashes.SHA256())