My notes for the Seeed XIAO nRF52840 & Wio-SX1262, used in various of my solar repeaters.
To check the bootloader version (firmware 1.14+), log into the repeater and use the CLI to execute the get bootloader.ver command.
My notes for the Seeed XIAO nRF52840 & Wio-SX1262, used in various of my solar repeaters.
To check the bootloader version (firmware 1.14+), log into the repeater and use the CLI to execute the get bootloader.ver command.
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
| """ | |
| Script to automatically update uv.lock and then update pyproject.toml dependencies. | |
| Prerequisites: | |
| 1. Python 3.11+ (for tomllib) | |
| 2. tomli-w package (`pip install tomli-w`) | |
| 3. uv installed and available in PATH | |
| Usage: | |
| Run this script: `python upgrade_pyproject.py` |
| #!/bin/bash | |
| # The use case is that I have an 1024-bit RSA key which I have used for many years to access many remote servers. | |
| # I want to stop using it (don't load it into my ssh-agent), and instead use my new ED25519 key. | |
| # I need a convenient way to update the authorized_keys file on a remote server. | |
| # This solution is tested and working on Ubuntu 20.04 host | |
| # It works on many distributions/versions of remote servers, including Ubuntu 16.04/18.04/22.04 and CentOS 7.9. | |
| # Instructions: |
| #!/usr/bin/env bash | |
| # Import SSH keys from Github to ~/.ssh/authorize_keys for all members of a | |
| # given Github organization. | |
| # | |
| # Will replace authorized_keys, if it looks like authorized_keys was not | |
| # previously created by this script then a backup copy is made. | |
| # | |
| # Depends on jq, will download it if not available (assumes Linux) to ~/bin/jq | |
| # |
I recently built a small agent-based model using Python and wanted to visualize the model in action. But as much as Python is an ideal tool for scientific computation (numpy, scipy, matplotlib), it's not as good for dynamic visualization (pygame?).
You know what's a very mature and flexible tool for drawing graphics? The DOM! For simple graphics you can use HTML and CSS; for more complicated stuff you can use Canvas, SVG, or WebGL. There are countless frameworks, libraries, and tutorials to help you draw exactly what you need. In my case, this was the animation I wanted:
(Each row represents a "worker" in my model, and each rectangle represents a "task.")
| """ This module contains a simple identicon creation utility function. | |
| Original color palette : coolors.co/659bd8-ff776d-ffd793-9eefae-c99dba | |
| """ | |
| import hashlib | |
| import random | |
| import png # requires pypng (version 0.0.19 recommended) | |
| import sys | |
| palette = {0: (255, 255, 255), | |
| 1: (101, 155, 216), |
| import discord | |
| from discord.ext import commands | |
| import sys, traceback | |
| """This is a multi file example showcasing many features of the command extension and the use of cogs. | |
| These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic | |
| understanding and platform for creating your own bot. | |
| These examples make use of Python 3.6.2 and the rewrite version on the lib. |
I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6
apt-get update && apt-get install gdb
| #!/bin/bash | |
| #no PATH, no way to accidently run any programs | |
| PATH='' | |
| #useful variables | |
| term_height=0 | |
| term_width=0 | |
| term_scroll_height=0 | |
| status_line_row=0 |