24

Introducing the Rust 101 series and how to install Rust.

Rust 101 is a series of videos explaining how to write programs in Rust.

How to install Rust: https://rustup.rs/
Slides: http://artificialworlds.net/presentations/rust-101/0-intro
Exercises: https://101-rs.tweede.golf/0-install/mod.html

Follow the "Exercises" link to find the other tools you might want to install to follow along.

The course materials for this series are developed by tweede golf. You can find more information at https://github.com/tweedegolf/101-rs and you can sponsor the work at https://github.com/sponsors/tweedegolf . They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2023 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.

Duration: 9min 44sec


This project is on-going, is hosted on PeerTube, and we aren't too far behind, so I thought it might be of interest.
Playlist so far: https://diode.zone/w/p/xesbWmNanEHNBfJCZFQRUm

top 2 comments
sorted by: hot top controversial new old
[-] maegul@lemmy.ml 2 points 5 months ago

So this actually looks great, and all fediverse too (on Peertube, fediverse answer to YouTube)!

FYI, you can subscribe to Peertube channels on lemmy.

In this case, search “ !andybalaam_lectures@diode.zone” in the lemmy search (you can specify a community search if you like). You may have to repeat this a few times as you server goes fetches the meta data. Once it shows up you can subscribe and start pulling in content into your instance.

Unfortunately older posts don’t come through, such as these videos.

But, you can just run a lemmy search for a video’s URL, and repeat it a couple of times if necessary, and Lemmy will go and fetch it.

This way, the videos look like posts in lemmy, which we can cross post and comment on. Commenting on particular should be cool because the video author themselves will get them and probably reply.

I might go ahead and do all of that myself for my instance and provide a link to their channel from the side bar.

[-] freamon@endlesstalk.org 3 points 5 months ago

Subscribing to his channel from Lemmy never even occurred to me (?!)

Now is as good a time as any though to investigate Lemmy/PeerTube interactions:

The search that lemmy will do:
curl --header 'accept: application/activity+json' https://diode.zone/.well-known/webfinger?resource=acct:andybalaam_lectures@diode.zone | jq .
The 'activity+json' links section reveals that the url is https://diode.zone/video-channels/andybalaam_lectures

'Click' on that:
curl --header 'accept: application/activity+json' https://diode.zone/video-channels/andybalaam_lectures | jq .
Interesting parts:
'type' is Group, which is what lemmy uses for communities
there's no 'moderators' link, so that'll be empty on the community page
'outbox' is at https://diode.zone/video-channels/andybalaam_lectures/outbox which lemmy should be able to use to fetch the recent videos. It doesn't work because community outboxes on Lemmy just list the last 20 posts directly, whereas PeerTube (and Mastodon) redirect you to a 'outbox?page=1' url.
'playlists' is at https://diode.zone/video-channels/andybalaam_lectures/playlists, which is what we want really (the Rust 101 playlist)
These are of type Playlist though, which Lemmy doesn't know what to do with.

Following the 'playlist' link:
--> https://diode.zone/video-channels/andybalaam_lectures/playlists?page=1 (posts 1 to 10)
--> https://diode.zone/video-channels/andybalaam_lectures/playlists?page=2 (post 11)

Bash script to get the URLs

#!/bin/bash

curl --silent --header 'accept: application/activity+json' "https://diode.zone/video-playlists/fcec1b54-0908-452e-9d35-84c9627c3b50?page=1" > /tmp/page1.json
curl --silent --header 'accept: application/activity+json' "https://diode.zone/video-playlists/fcec1b54-0908-452e-9d35-84c9627c3b50?page=2" > /tmp/page2.json

for i in {0..9}
do
    item=$(jq -r ".orderedItems[$i]" /tmp/page1.json)
    url=$(curl --silent --header 'accept: application/activity+json' "$item" | jq -r .url)
    sleep 1.1s
    echo $url
done

item=$(jq -r ".orderedItems[0]" /tmp/page2.json)
url=$(curl --silent --header 'accept: application/activity+json' "$item" | jq -r .url)
echo $url

gives us:

https://diode.zone/videos/watch/f8e9baa2-9f19-4061-91f4-2d35fada767e                  
https://diode.zone/videos/watch/6b08bb1f-b3ef-40d4-addf-cf45e1da1a7a                  
https://diode.zone/videos/watch/020c07e6-f124-4b3e-8270-cc2d21bf9c67               
https://diode.zone/videos/watch/9766d1f1-6018-48ec-ad67-e971758f8a3a                 
https://diode.zone/videos/watch/567552a8-34df-4a00-b598-c92d903329fb               
https://diode.zone/videos/watch/8be50e04-2cd1-4e2d-8f27-61dc1dc51170             
https://diode.zone/videos/watch/90e5627c-caa8-47a7-b7b6-74bb79a26977             
https://diode.zone/videos/watch/a1604d25-d0b0-4e2c-baf4-3a2b193708e0             
https://diode.zone/videos/watch/a752daf8-60c2-46d7-a36f-7d7fcda9a0a5           
https://diode.zone/videos/watch/659f9b07-11c7-4f52-9e8e-becce02e40fe           
https://diode.zone/videos/watch/03735b5f-8ace-411c-998e-7c4a58a11914           

I used endlesstalk.org's Search to bring most of these through, before getting bored and using the API. e.g.:

curl --request GET \
     --url 'https://endlesstalk.org/api/v3/resolve_object?q=https://diode.zone/videos/watch/03735b5f-8ace-411c-998e-7c4a58a11914' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer $MY_JWT_TOKIN'

So the bash script could easily be modified to resolve everything as well.

this post was submitted on 08 Feb 2024
24 points (100.0% liked)

Learning Rust and Lemmy

231 readers
3 users here now

Welcome

A collaborative space for people to work together on learning Rust, learning about the Lemmy code base, discussing whatever confusions or difficulties we're having in these endeavours, and solving problems, including, hopefully, some contributions back to the Lemmy code base.

Rules TL;DR: Be nice, constructive, and focus on learning and working together on understanding Rust and Lemmy.


Running Projects


Policies and Purposes

  1. This is a place to learn and work together.
  2. Questions and curiosity is welcome and encouraged.
  3. This isn't a technical support community. Those with technical knowledge and experienced aren't obliged to help, though such is very welcome. This is closer to a library of study groups than stackoverflow. Though, forming a repository of useful information would be a good side effect.
  4. This isn't an issue tracker for Lemmy (or Rust) or a place for suggestions. Instead, it's where the nature of an issue, what possible solutions might exist and how they could be or were implemented can be discussed, or, where the means by which a particular suggestion could be implemented is discussed.

See also:

Rules

  1. Lemmy.ml rule 2 applies strongly: "Be respectful, even when disagreeing. Everyone should feel welcome" (see Dessalines's post). This is a constructive space.
  2. Don't demean, intimidate or do anything that isn't constructive and encouraging to anyone trying to learn or understand. People should feel free to ask questions, be curious, and fill their gaps knowledge and understanding.
  3. Posts and comments should be (more or less) within scope (on which see Policies and Purposes above).
  4. See the Lemmy Code of Conduct
  5. Where applicable, rules should be interpreted in light of the Policies and Purposes.

Relevant links and Related Communities


Thumbnail and banner generated by ChatGPT.

founded 5 months ago
MODERATORS