Skip to content

Instantly share code, notes, and snippets.

View mcr's full-sized avatar

Michael Richardson mcr

View GitHub Profile
@mcr
mcr / iotops.md
Created September 10, 2024 15:26
IOTOPS charter discussion

Charter for Working Group The IOTOPS Working Group is chartered for the discussion of operational issues related to Internet of Things (IoT) devices, in particular related to device onboarding and lifecycle management.

IoT has a rather nebulous definition with different meanings for different people.

For the purposes of this WG, its focus is on devices that

are networked, either to the Internet or within limited administrative domains

have a very limited end user interface or no end-user interface at all

fn main () -> Result<(), String> {
let mut rt = tokio::runtime::Builder::new()
.basic_scheduler()
.build().unwrap();
let future = do_it(&rt);
println!("blocking in main");
rt.block_on(future).unwrap();
return Ok(());
}
pub fn setup_writer(writer: tokio::net::UnixStream) -> impl Stream {
let my_write_stream = FramedWrite::new(writer, LengthDelimitedCodec::new());
return tokio_serde::SymmetricallyFramed::new(my_write_stream, SymmetricalCbor::default());
}
let mut serialized = setup_writer(pair.0);
...
to refactor from code that did:
@mcr
mcr / gist:4c1a46d05474a00f33a59c56946c4c92
Created September 13, 2020 20:25
IPv6 policies and routing tables on Android Oreo
generic_x86:/ # ip addr ls
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 02:00:00:44:55:66 brd ff:ff:ff:ff:ff:ff
inet 192.168.232.2/21 brd 192.168.239.255 scope global wlan0
@mcr
mcr / gist:edf3a31ecfeb78564b46ae3b2ff00742
Created June 27, 2019 15:44
starting mud_telemetry
export LD_LIBRARY_PATH=/usr/local/rvm/rubies/ruby-2.6.3/lib/
. /etc/profile.d/rvm.sh
rvm use 2.6.3 >/dev/null
export CERTDIR=/app/certificates
export SERVCERT=${CERTDIR}/jrc_prime256v1.crt
export SERVKEY=${CERTDIR}/jrc_prime256v1.key
elros-[projects/shg/staging] mcr 10113 %cat staging.sh
#!/bin/sh
set -e
MOUNT="--mount source=comet_certs,target=/app/certificates --mount source=eeylops_devices,target=/app/devices"
if docker ps | grep eeylops; then
docker stop eeylops_staging
docker rm eeylops_staging || true
fi
obiwan-[projects/shg/shg_highway](2.5.3) mcr 10091 %spotify &
[1] 8902
obiwan-[projects/shg/shg_highway](2.5.3) mcr 10092 %ATTENTION: default value of option force_s3tc_enable overridden by environment.
[0316/211419.546229:ERROR:nss_util.cc(748)] After loading Root Certs, loaded==false: NSS error code: -8018
[0316/211422.011001:ERROR:input_method_base.cc(146)] Not implemented reached in virtual ui::InputMethodKeyboardController *ui::InputMethodBase::GetInputMethodKeyboardController()Using InputMethodKeyboardControllerStub
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
/usr/share/spotify/spotify: ../../src/xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
@mcr
mcr / gist:96000bdfd516306dbedfadf16953733a
Last active March 16, 2019 22:27
ACME-Client and DNS-Update example
# something wrong with authenticating the SSL key for staging server.
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
# AcmeKeys is a local class that collects stuff including the key pair for authenticating and options,
# and which server to talk to, and DNS update options for my dasblinkenled.org zone.
puts "Server at: #{AcmeKeys.acme.server}"
client = Acme::Client.new(private_key: AcmeKeys.acme.acmeprivkey,
directory: AcmeKeys.acme.server)
account = client.new_account(contact: 'mailto:minerva@sandelman.ca',
terms_of_service_agreed: true)
@mcr
mcr / gist:8e9b0ca1d66fd2c104172bcc11d212ce
Created December 28, 2018 22:32
backing store investigation
taylor-[~/DrTaylorPlumage] mcr 10113 %sudo -u libvirt-qemu qemu-img info --backing-chain /srv/openswan-testing/build/images/alice.qcow2
image: /srv/openswan-testing/build/images/alice.qcow2
file format: qcow2
virtual size: 3.0G (3221225472 bytes)
disk size: 4.5M
cluster_size: 65536
backing file: /srv/openswan-testing/build/images/root.OPENSWAN.work2.6.52.qcow2
Format specific information:
compat: 1.1
lazy refcounts: false
@mcr
mcr / gist:a0e003af6d3e400a7553543c19da8b95
Created February 9, 2018 01:35
IPv6 literals vs URI and Addrinfo
Either URI should be removing the [], or Addrinfo should be accepting it. Given that Addrinfo is just getaddrinfo(3), and it does not peel off the [], I think the fault is URI.
2.4.1 :007 > n = URI.parse("https://[::2]:1234/")
=> #<URI::HTTPS https://[::2]:1234/>
2.4.1 :008 > Addrinfo.udp(n.host, n.port)
SocketError: getaddrinfo: Name or service not known
2.4.1 :009 > n = URI.parse("coaps://[::2]:5684/")
=> #<URI::Generic coaps://[::2]:5684/>