CS371p Fall 2018: Eduardo Campos

Eduardo Campos
Sep 9, 2018 · 4 min read

Week of 3 Sep — 9 Sep

What did you do this past week?
This past week was all about learning new things. In this class, I managed to get familiar with Docker, some C++ libraries and HackerRank, as well as using the Issue Tracker in GitLab. I was able to get the Collatz project up and running and ready to start developing it. For my Neural Networks class, I’ve been busy learning a whole new material as well as complete homework and start on projects. From first impressions, I feel like this semester is going to be heavy on workload, but then again, that’s always the case in this field.

What’s in your way?
At the moment, I am not facing any particularly difficult obstacles as I have been making good progress on my upcoming homework and projects. The only major responsibility to worry about now is finishing up the Collatz project, which I’m planning on finishing sometime next week. I’m somewhat behind on my reading for my other classes so tomorrow I’ll spend most of the day catching up.

What will you do next week?
Sometime next week I will finish my Collatz project. I will also read textbook chapters for all my classes as I strive to stay on top of things. It is also a good time to start studying for my tests so I don’t have to cram everything in the last minute. One of my goals for next week is to sharpen my c++ skills for what is yet to come in this class this semester so I’ll be messing around with it a lot. I also plan on going out for dinner with some friends I haven’t seen since last semester so that should be fun.

What’s my experience of the class?
I’m really liking this class. I’m really impressed with how much I’m learning so far, and this is just the beginning. I’m happy that after this class I’m sure I will have an ample set of skills and knowledge that I can start applying now and later on in my career. Professor Downing is a remarkable professor and the way he runs the class is an immersive experience and efficient in keeping you alert and attentive.

What’s my pick-of-the-week or tip-of-the-week?

My pick-of-the-week is Cron, a time-based software utility for Unix-like operating systems. It allows you to edit a crontab(cron table) file that specifies shell commands to run periodically on a given schedule. As you may know, there are things like the at command that allows you to run a shell command or script at any given time, for instance:

$ echo “ls -al” | at midnight

would schedule and run the shell command ls -al at midnight.

What makes crontabs more fun is that you can schedule recurring scripts to run at month, day of the week, hour of the day, and minute. If you get creative you can easily program a Spotify playlist to shuffle and wake you up in the mornings on weekdays. This is how you would do it:

If you’ve never edited crontabs before, you need to set your preferred (cron-compatible) editor for cron to use:

$ EDITOR=vim
$ export $EDITOR

After that, is just a matter of editing your crontab:

$ crontab -e

Then edit the crontab in the following way (one entry per line):

┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of the month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of the week (0 - 6) (Su to Sat)
│ │ │ │ │
│ │ │ │ │
* * * * * command to execute

(From Wikipedia)

And so if you wanted to fire up Spotify every weekday at 7 am, a line in crontab would look like this (notice the use of wildcards to match everything):

00 07 * * 1-5 osascript ~/Developer/morning.scpt

Where morning.scpt is an AppleScript script I wrote that shuffles and plays the “Have A Great Day!” playlist from Spotify, gradually incrementing the volume:

-- Mac volume, not Spotify volume
set volume 4
-- Open Spotify
tell application "Spotify"
-- Duplicate mute command to wait for warmup
set the sound volume to 0
delay 10
set the sound volume to 0

-- Shuffle playlist
set shuffling to true
play track "spotify:user:spotify:playlist:37i9dQZF1DX7KNKjOK0o75"

-- Increase the volume
repeat 10 times
if sound volume is less than 80 then
set sound volume to (sound volume + 10)
delay 3
end if
end repeat
end tell

And you’re done! Enjoy your new alarm!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade