Skip to content

Instantly share code, notes, and snippets.

@romilly
romilly / keybase.md
Last active August 29, 2015 13:57
Keybase ID Proof

Keybase proof

I hereby claim:

  • I am romilly on github.
  • I am romilly (https://keybase.io/romilly) on keybase.
  • I have a public key whose fingerprint is 878A 89AD 2AC2 E315 1E6C 5398 72CA 4FA2 E7CB 6E36

To claim this, I am signing this object:

import feedparser
feed = feedparser.parse('http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml')
print feed['feed']['title']
print len(feed)
@romilly
romilly / ser.py
Last active May 22, 2019 15:03
Real and print lines from a serial input
import serial
with serial.Serial('/dev/ttyACM0', 9600, timeout=10) as ser:
while True:
print(ser.readline())
@romilly
romilly / blog.md
Last active January 26, 2021 09:58

Why I use APL every day

I first met APL (A Programming Language) in 1968.

I've always used it a lot, and now I use it every day.

Many developers will never have heard of the language. Many of those that have, either love it (as I do) or hate it.

I think now is the time to explain what APL is, why I use it so often, and why I think that developers should take a look at it.

import serial
class Talker:
TERMINATOR = '\r'.encode('UTF8')
def __init__(self, timeout=1):
self.serial = serial.Serial('/dev/ttyACM0', 115200, timeout=timeout)
def send(self, text: str):
"""
Example for remote control from host via Serial link.
This is the code to run on the Pico.
It sets up the onboard LED and allows you to turn it on or off.
"""
from machine import Pin
# use onboard LED which is controlled by Pin 25
# on a Pico W the onboad lLED is accessed differently,
@romilly
romilly / scope.md
Last active February 5, 2021 09:24

Pico AF oscilloscope

I've moved the journal and code for the 'scope to the Pico Code Project on GitHub.

@romilly
romilly / fungen.md
Last active February 5, 2021 09:31

Testing a Pico-based function generator

I've moved the journal and code for fungen to the Pico Code Project on GitHub.

@romilly
romilly / pico-uart.py
Created February 23, 2021 07:23
Drive UART1 on a Raspberry Pi Pico
"""
MicroPython code to read and write from UART1 on the Pico
UART0 is not available as it is used for the REPL.
To test, you can use a 3V3 FTDI cable or similar device that connects a host computer with the Pico.
NB: Make sure it's a 3V3 cable, not a 5V cable, or you could kill your PIco!!
Connect FTDI black to Pico GND.
import xml.etree.ElementTree as ET
import html2text
def convert(enex_file_name: str, markdown_file_name: str) -> None:
enex = ET.parse(enex_file_name)
root = enex.getroot()
note = root.find('note')
html = note.find('content').text
text = html2text.html2text(html)