Recurse Center, week 11

2024-03-21

A weekly log of my activity at the Recurse Center, a 12-week programming retreat.

Tags: rc

<< previousnext >>

Monday, March 11th

Attended an Emacs masterclass organised by Reed and Thomas. It was cool to see more of Doom Emacs. My biggest takeway, however, was that the space character can be used as a command prefix, which avoids putting strain on your pinky.

Had a career chat with Jake. This was EXTREMELY helpful for getting a sense of the data science career path, so thanks to Jake!!

Fixed a few bugs in the BitTorrent client that arose during the latest round of testing. As a result, I was able to successfully transmit the first 1MB chunk of my test file! The next chunks kept failing their hash checks, though, so I'll need to debug that.

Tuesday, March 12th

Made slides for the presentations on Thursday, where I'm gonna talk about C-calling-assembly-calling-C.

Paired with Mani on his L-system app, cool to see TypeScript in action for the 3rd time! Also interesting to see Svelte and the canvas API as a graphics environment.

Fixed the BitTorrent bug from yesterday where the first chunk of data was sent successfully but the ones after that were failing their hash checks. Turns out I wasn't offsetting based on the index of the data chunk, which had the effect of sending the first chunk over and over. Now running my test in the background and it seems to be working, at the lightning-fast speed of... ~110KB/s. For my 1GB test file, that will take... 2ish hours. I don't care if it's fast as long as it works, though. Optimising it can be a challenge for another day.

Will's burnout talk was super interesting and timely! I feel like I fell off the self-care bandwagon towards the end of my PhD, and haven't fully recovered from it. Now feeling inspired to take up journaling and meditation again!

Wednesday, March 13th

My Final Test of the BitTorrent client failed yesterday. All the data chunks were transmitted and passed their hash checks, but somehow the final file on disk was a couple megabytes oversized. I (think I) fixed this by opening the file in a different mode. Then, after creating a smaller ~2MB test file that wouldn't take 2 hours to transmit, I successfully downloaded it from myself!! 🎉 I think that's a nice place to wrap up this project. Feels somewhat anti-climactic!

Thursday, March 14th

Started reading Learning From Data, got as far as implementing a simple training algo for the perceptron/linear model. Mostly just reacquainting myself with numpy and trying to build intuitions. I had ambitions to do all my coding in J, but realised that learning a weird programming language AND math stuff at the same time was never going to work. So I'm back to the safety of numpy and Jupyter Notebook.

A visualisation of training data and the perceptron's linear separation (I don't know why it's not just called a linear classifier?):

Two clusters of data, one with yellow datapoints in the bottom left corner and the other with purple datapoints in the top right corner. They're separated by a red line.
Two clusters of data, correctly separated and classified by a perceptron model.

I gave my presentation about assembly-calling-C-calling-assembly. It was way too much content for a 5-minute presentation, and I was a lot more nervous than expected! Also realised that I assumed too much prerequisite knowledge about assembly and C. Oh well. I still least got some nice feedback. Next week I'll present about BitTorrent.

Paired with Stephanie. I talked through the C/assembly in my slides in more detail, and shared my hot take that assembly is simpler than Python. (I may not be qualified to make such a hot take, given that FizzBuzz is among the most complicated things I've coded in assembly). Then she did a great job explaining the CryptoPals challenge she was working on, and we debugged her MD4 implementation. Now excited to try CryptoPals!

Friday, March 15th

Converted my account of the Center for Computing History into a blog post. Also wrote some niceties (encouraging notes that Recursers write for each other at the end of a batch).

Tried out Reaper (a DAW - Digital Audio Workstation). After A LOT of tinkering, and almost at the point of giving up, I managed to record some microphone input. Yay! (Everything to do with audio is surprisingly complicated). I also started working through Zack's SuperCollider workshops, except I'm using Common Lisp & Emacs instead of sclang & the SC IDE.

This, in sclang...

SynthDef("coolsynth",{
    arg freq=110, amp=0.1;
    var snd;
    snd=Mix.ar(
        SinOsc.ar(freq:[freq,freq*2,freq*4],mul:[amp,amp/2,amp/4])
    );
    snd=snd+(0.1*Mix.ar(
        Saw.ar(freq:[freq,freq*2,freq*3,freq*4],mul:[amp,amp/2,amp/3,amp/4]))
    );
    snd=Splay.ar(snd);
    Out.ar(0,snd);
}).play;

...ends up looking like this in Common Lisp / cl-collider:

(defsynth coolsynth ((freq 110) (amp .1))
  (out.ar 0
          (splay.ar
           (+
            (mix
             (saw.ar [freq (* 2 freq) (* 3 freq) (* 4 freq)]
                     0
                     [amp (/ amp 2) (/ amp 3) (/ amp 4)]))
            (mix
             (sin-osc.ar [freq (* freq 2)]
                         0
                         [amp (/ amp 2)]))))))

I'm conscious that this code doesn't reflect the "flow" of the synth all that well, as you have to read it from bottom to top. But I think this could be fixed by using the arrows macro, like so (untested):

(defsynth coolsynth ((freq 110) (amp .1))
  (->>
   (mix (sin-osc.ar [freq (* freq 2)]
                    0
                    [amp (/ amp 2)]))
   (+ (mix
       (saw.ar [freq (* 2 freq) (* 3 freq) (* 4 freq)]
               0
               [amp (/ amp 2) (/ amp 3) (/ amp 4)])))
   (splay.ar)
   (out.ar 0)))

<< previousnext >>

I'd be happy to hear from you at galligankevinp@gmail.com.