Posts

Ever wonder how the square-root button on your calculator works? Nope, it's not the Underpants Gnomes. In this screencast we will demonstrate Newton's method of making a series of guesses, each one getting us closer to our answer. we're gonna need an average function which will take x and y, add them together and divide that by 2. now our newton function will take a guess in addition to our number that we want the square root of. It will divide our number by the guess and average that with the previous guess. Let's try it on 81. Start with an initial guess of 1.0. We get 41.0. So we run it with that. And again, and again, until we start to converge on the answer. As we see, the square root of 81 is 9. So now we can write a function to do that all for us. We'll get the absolute value of a number, by taking its negation and seeing which one's bigger. To check the answer, we square it, or multiply it by itself. We can now write our square root function. It

Sleepless in Seattle (literally!)

Image
What is that movie even about, anyway? Not sure if I really care, but the title pretty much describes my experience here so far. Seems like Seattle doesn't want to let me sleep. That's a commodity that's currently too rich for my blood. My first night was spent just sitting. Right on the sidewalk. About as uneventful as you can get. I relaxed as much as possible but couldn't let myself doze off because I was on the job - guarding my mobile office from those grabby types. This time, I'm here on business and only have exactly what I need - no more, no less (though I certainly wish it were less). In the morning, I realized that I had just enough change for a cup of coffee, but accidentally walked into this weird special Starbucks "Reserve" store. They handed me a menu. What? I ordered a large... I mean, Venti, and it was nearly five bucks! Normally I would have bought it and felt extremely stupid. But since I was unable to do so, it was not only sup

MilkyTracker: The quest for the perfect music software

Image
The last album I made was in 2013 on a MacBook using Logic Pro and Massive, a setup that cost a couple thousand dollars. Since I no longer have that machine and the software was proprietary, I no longer have access to all of that work. This has sparked a great interest in searching for a replacement digital audio suite, one that would provide a comparable workflow but also offer longevity, the ability to archive my work in a format that can be shared across platforms and improved upon. An artist should demand nothing less! What if a painter had to stop working on everything because they didn't want to use canvas from a certain company, and then none of their brushes or paints would work? That's what is actually happening in today's creative landscape, but with software. Whatever program I use must, above all else, use a standard file format for music encoding, which is usually MIDI but there are others. That way none of my work is dependent on any specific piece of

Part 2: Software Development Tools

sudo apt-get install python3-pip sudo apt-get install python-pip sudo pip install --upgrade youtube_dl sudo apt-get install dosbox sudo apt-get install oracle-java8-jdk sudo apt-get install gnome-disk-utility sudo apt-get install leafpad sudo apt-get install libreoffice Emacs - do whole video on this. Leiningen - save lein script to /bin/lein, then: sudo chmod a+x /bin/lein lein sudo apt install emacs24 git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d .spacemacs config: (setq-default dotspacemacs-configuration-layers '((clojure :variables clojure-enable-fancify-symbols t))) vim/fireplace (do whole video on this): sudo apt-get install vim git clone https://github.com/ctford/vim-fireplace-easy.git .vim ln -s ~/.vim/vimrc.vim ~/.vimrc vim -c "helptags ~/.vim/bundle/vim-fireplace/doc" -c "q"

Retro-Gaming and Software Development Platform: A Step-by-Step Guide

Image
Get retropie-4.3-rpi2_rpi3.img from  https://retropie.org.uk/download/ Flash it to your sdcard, boot and press F4 to exit to shell. Install graphical desktop: sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install xserver-xorg sudo apt-get install xinit sudo apt-get install raspberrypi-ui-mods sudo apt-get install -y rpi-chromium-mods sudo apt-get install -y python-sense-emu sudo apt-get install -y python-sense-emu-doc sudo apt-get install -y realvnc-vnc-viewer sudo apt-get install lxde Your best friend: sudo raspi-config There you can do all kinds of stuff, I recommend changing your password and enabling ssh in the interface options. Set your appropriate locale (mine is en_US.UTF-8), keyboard layout - English (US, alternative international), and wifi country. Use the spacebar to select/deselect. Type startx to load lxde.

Programming: The New Rock 'N' Roll

Image
In this post we will set up a super efficient programming environment - on a $10 computer, in just a few short lines of code! Step 1 - Install tmux , a terminal multiplexer. This will allow us to work in as many simultaneous terminal windows as we need to, just as if we are in a graphical desktop but all from a single text console: sudo apt install tmux Begin a session with the "tmux" command. Open a new window with Ctrl-b c and switch between them with Ctrl-b n. Step 2 - Install leiningen , vim and fireplace (formerly called "foreplay"). They work together with the Clojure programming language, which uses an extremely concise syntax to generate highly optimized Java and Javascript code: sudo apt install vim git clone https://github.com/ctford/vim-fireplace-easy.git .vim ln -s ~/.vim/vimrc.vim ~/.vimrc vim -c "helptags ~/.vim/bundle/vim-fireplace/doc" -c "q" (Paste the contents of this file into /bin/lein) sudo

Pardon My Parsing...

Image
Advent of Code 2016 problems Since they all involve parsing some kind of input data, this will be a job for ... Instaparse ! With it we can use a context-free grammar to generate a tree-like structure from our data. For example, here an input string for the day 4 problem. Each room is represented as a key, id and checksum: aaaaa-bbb-z-y-x-123[abxyz] The key is made of one or more strings of letters separated with hyphens. The id is a string of numbers, and the checksum is a string of letters in brackets. This is how we represent that in EBNF notation... In Clojure!: (def room-parser (insta/parser "room = key id checksum key = (word <separator>)+ <separator> = '-' word = #'[a-zA-Z]+' checksum = <'['> word <']'> id = #'[0-9]+'")) Now we pass the input to our shiny-new parser: (room-parser "aaaaa-bbb-z-y-x-123[abxyz]") And we get our magical tree! Ooowee! => [: