iPad Learning

Taking a break from k8s on pi as I’m thinking through next steps, or even if there are next steps. Currently with the rPi series you can basically do whatever you want. I mean, I setup and ran both parts of kNative, so there really isn’t much of a limit.

Let’s look at a different use case for rPi. An accessory for iPad that will enable coding. I fly for work a fair amount, and wanted a smaller solution to learn code while flying. I wanted to enable this a couple of different ways. First, I wanted to enable vsCode on the rPi. I didn’t think this would be an issue as code-server has been out for a while, and I haven’t seen a lot of trouble getting it running. Second, having the binaries for the code languages I’m running. I know code-server would allow the terminal to run, but would it also let me run code files, as well? Third, and finally, GIT. Yup, I want the trio. Code IDE, Code Binaries, and Code Repository, and well, I got it. It may be silly to go through the steps in order to just grant yourself the ability to do things that a MacBook Air can do as well as other things, but I really l Ike the mobility of the iPad and want to push it as far as possible.

USB rPI Connection

Not much to add here, an awesome blog with steps for this has already been written here: https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/ – Ben Hardill

Just follow those steps and you will be able to connect to the pi through the USB port and power it. It DOES take a LOT of power from the iPad, but you should be able to perform this while on a flight. This will let you SSH into the pi without local WiFi, or networking. The rPi will be on the 10.55.0.1 IP address if you go through these steps to the letter.

One thing of note. You can still use the wlan on the rPI to connect to WiFi if you need external networking. Just ssh to the 10.55.0.1 and then run the regular “raspi-config” to enable and setup the WiFi connection. Or you could install raspAP for a GUI interface to scan and connect to WiFi SSID’s.

Code-Server

Now, this was a bit of a challenge but nothing too hard. Code-Server has some issues with architectures outside of its scope. I could try to compile or change some things to run it on raspberryOS, but instead I opted for a different solution, Docker. There is a docker registry here that will let you run this docker image locally on the pi. So installing docker first via “sudo apt install docker.io” installs Docker, then run the docker image commands will enable it. It’s worth mentioning if you run the basic commands, the docker image will run on boot, so you can unplug, and plug in the rPi without fear of losing the image. It also maintains the storage of your code which is pretty crucial. One other thing is Code-Server doesn’t have ALL the extensions that a normal vsCode affords, but it has most of them. I was able to enable all of the extensions I normally use, so I don’t see this as an issue, but just something to be keep in mind.

Hello darkness my old friend… Oh yeah, dark mode is available too…

Code Binaries

This part isn’t difficult, but I got spun around on it for some reason. By now you should be able to access the code-server within the usb interface using 10.55.0.1:8443 and using the default password. This then, allows you to access the terminal within the container so you can install the binaries locally(if your not too familiar with Docker exec commands). With this you can run your “apt-get install” commands for golang, python2/3, java, and whatever. Now you have the ability to create files in your IDE and format/lint/intellisense your files to make it easier to write, and be able to run them within the terminal.

GIT

This part was super easy, because GIT was already built into the docker container. So all you really need to do is connect with your Git repo via SSH or HTTP, and get to coding. This comes with the basic push/pull/fetch, just remember you should be connected to the WiFi on the pi in order to commit/push your changes.

Thoughts

Really this is just to get awareness out there about the different things that you can do with Pi’s. I saw this and immediately knew it was something I was going to do. It was really a fun weekend project, and I’ll be using this to learn GO with Todd McLeod’s Udemy course. You may have other reasons to do something like this. Heck maybe you see this and thing, “WWDC is 2 weeks away, I bet vsCode will be available” and if it is, then I’ll be crazy happy. But till then, this was a fun side project. If you want, give it a try.