Archive for October, 2018

Music Can Bring More Than Just Ideas To Life

Wednesday, October 31st, 2018

Last night I made a trip back to where I've spent most of my time in Costa Rica, Tamarindo. I brought the essentials: clothes, board shorts, a computer, my guitar, and my friend's melodica. Shortly after I arrived the sound wave weapons were drawn and we started to play some of our classics.

I had been living alone for a few days with very little human interaction, and it was good to be back with the boys and some new friends. One of my buddies started playing a song written by him, and i hastily picked up the melodica because his song is one of the few things I can play on that little device.

Now for those of you who don't know what a melodica is, it is essential that you understand the structure of this instrument to comprehend what happens later in the story. It is essentially a piano and a flute combined. Before I knew the instruments proper name, we had aptly named the device the "plute." It has a normal piano keyboard, but instead of the keys making drums hit strings, the keys change the structure of an internal tube, and the sound is produced by blowing through a hole.

Normally a melodica is played by laying it down on a surface, like you would for any other type of keyboard, and a long bendable tube is attached to the melodica's air input hole. However, absent having the bendable tube, you can just hold the melodica with your hands and blow directly into the hole. It limits your ability to play the melodica, because your thumbs must be used to hold the instrument. But for simple tunes it is a much more enjoyable way to play. This was the manner I was playing that night.

Now back to our story...

My buddies began the jam and I waited patiently to play trying while i tried to listen to and remember the notes in the song. (It's better to be silent and thought of as a non-musician than to play out of key and remove all doubt...) As the notes came back to me I readied my weapon by placing my fingers on keys and and took in a long breath.

The song came to life as three of us danced around our instruments to the pleasure of ourselves and our two lady audience members. My role in this song is pretty simple, cycle through four notes, blow hard when my buddies strum their guitars hard. Staying in beat and playing the notes to this song is easy, so I add a little color to the music by playing the melodica with absurd expression.

The melodica is an instrument that you just can't help but laugh at. It looks like a kid's toy, indeed it is a kid's toy, but the notes come out loud and proud. It took me a bit to be able to play the thing without starting to giggle myself, especially while moving it up and down as if it were the instruments position in space that changed the notes and not the keys pressed.

As I was playing I felt a tingly sensation on my face. Bugs in Costa Rica are more than abundant, and thus I feel these little guys on me all the time. However I also occasionally have tingling sensations on the extremities of my fingers etc. and it so the bugs can really mess with me, since sometimes I can't tell if i am just tripping or if there really is a bug brushing against me. However the music train was in motion and there was no option to stop, so i just contorted my face and kept jamming.

I managed to forget this uncomfortable sensation and push through the rest of the song to its proper conclusion where the notes peacefully fade away into the distance. We had one of the brief moments in life where something special was just experienced and no one can figure out what to say next. For the few moments before, the realization we filled the void with giggles and smiles.

And then it came. Out of nowhere she screamed,


what? I thought ot myself, and then in just under two seconds my brain put it all together. Ants create bases. The inside of the melodica is a large space with a tiny entrance, an absolutely perfect design for an ant colony. And the ants had just experienced the most tremendous thunderstorm of air waves and were NOT happy. They were rushing out of the sound hole at an unbelievable rate. How many fucking ants were in that thing, i have no idea, but it was no short of 100 and probably in the 200-250 range.

I rushed to the sink and sipped water, spat it out, sipped water, spat it out, i felt it all hit me at once. Now i had known just how strong the trance i must have gotten in with the music, because i felt the mother fuckers biting me everywhere. I rushed to the bathroom and threw off all my clothes and started showering immediately.

It took me only a few minutes to start laughing harder than i was laughing before, but that horribly disturbing image of the ants marching out of the melodica will probably stick with me for the rest of my life.

Zylon Game Design

Tuesday, October 30th, 2018

I'm currently designing a video game which is meant to be both playable by bots and humans.1

Here are the high level ideas:

1. The game is a game of incomplete information, they are on a map (2d array) where they only have a certain vision radius. However, the random function that is used to generate the game map is known, only the seed of the function is not known.

2. The game is an MMO, where users search around the map to find their friends/enemies. PVP is always on.

3. The game rewards smart play over heavy grinding.

4. Players have to search for save points. A save point is consumed once it is found. Save points have a maximum level threshold, so if you are a high level it is harder to "save." When you die you go back to your save point and you lose everything you gained between the time you last saved and the time you died.

5. The game is rate limited by something around 200ms. Each 200ms can be considered a "round." To be playing optimally a player must then be able to send a response to the server every 200ms. Players have ids that determine their move order (lowest id goes first).

6. Potentially we could raise the game rate to something like 10s. And then each player effectively batches up a series of moves that looks like "UUURRDDL" for "up up up right right down down left" The game then runs its code on the server, and sends backa reply to the user informing them of what happened.

To be continued.

  1. Concept taken from Eulora []

you gotta make room for your new tool in the box

Monday, October 29th, 2018

Once upon a time in my life I played chess. I still do on at times, but back in the day I would travel across the US to play in tournaments. Mind you, I was never very good, but for quite a few tournaments my rating settled at a point just below the cutoff point where you were required to play in the open bracket. Had I been just a little bit better, I would have lost many more games..

Flash forward a few years and I decided to read a bit of a book on "how to become a grandmaster" Now I don't remember which book this was, but I do remember that it said something along the following lines:

A grandmaster must commit almost all of his time to chess. In addition, a grandmaster can only choose to study the solution to so many endgames. This is because once he has completed studying for a few years, everytime he learns a new solution to an endgame he will begin to forget an old one. In some sense, he can load only so many solutions into memory, once he has done this he has to begin to discard old memories. Thus, the grandmaster must choose to study the most frequently occurring endgames in his meta.

In the same way, this is true of the process of programming. You can have only so many tools at your disposal, abstraction as functions, macros, 50 hotkeys that do different things, etc. Once you start to get too many tools you start to forget about all the tools you have. So part of this blog will be a journey to figure out what are the tools that are the most essential to a programmer.

To be continued with a list of the best set of tools, and maybe even more importantly a list of tools you SHOULD NOT use.

first draft of abstract sexp

Monday, October 29th, 2018

This is a solution to my previous post

about how to write an elisp function that will take a block of code and turn it into a function replacing the code with a call to the new function and passing in the appropriate parameter. One issue however is that at times we may want to take a list of forms (as would be in a progn) instead of just an sexpr.

(defun blink-list ()

(defun convert-to-funcall()
  (let (fun-name new-param)
      (setq new-param (thing-at-point 'symbol))
      (while (y-or-n-p "go up sexp?")
      (setq fun-name (read-string "Function Name: "))
      (insert "n(defun " fun-name " (" new-param ")n ")
      (insert ")n"))
    (insert "(" fun-name " " new-param ")")))

So to be clear if i have some code as below with my cursor represented by the | then when i call this function i will be able to pick how many times i want to go up the sexpr tree, with the parens blinking everytime i go up, and then i get to name the function and then a new function will be created which was just the code in the old function, with the old function being replaced with a call to the new function.

(defun double-if-even (num)
  (if (equal 0 (mod num 2)) (* nu|m 2)))

now i call my new elisp function, i don't climb the tree, and i pass the name "double" and i will get

(defun double (num)
  (* num 2))

(defun double-if-even (num)
  (if (equal 0 (mod n|um 2)) (double num)))

noticed how i put the cursor back to num in the if expr. now i will call my function convert-to-funcall again, but this time i will need to climb the sexpr tree once. i will name my function "evenp"

(defun double (num)
  (* num 2))

(defun evenp (num)
  (equal 0 (mod num 2))

(defun double-if-even (num)
  (if (evenp num) (double num))

How to think independently and get out of a cult

Monday, October 29th, 2018

Daniel Krawisz had a great video explaining on how to think independently. Here are two tips to get out of a cult:

Assume you're in a cult and you have to figure out what it is. Cult members are unaware they are in a cult, so if you are stuck in one to get out you must begin with the assumption that you are in one.

Embrace "evil." Cults paint the escape path from them as "evil" to keep their members locked in (i.e. the forbidden fruit) So you should at least entertain ideas that are forbidden within your circles, for they may be painted as evil to prevent you from seeing the way out.

The real reason i dont have an NSAbook or Instaspam

Sunday, October 28th, 2018

A lot of people ask me why I don't have an NSAbook or an Instaspam account, so I figured I'd answer it here. (Remember that NSABook bought Instaspam so

It's not because they expose an incredible amount of your personal data.

It's not because they work closely with failing corrupt governments.

It's not because Instaspam DOESNT EVEN PROVIDE A WEBAPP, forcing you to download the Instaspam app, which defaults to all privileges on the play store including your location.

It's not because I don't agree with most of the politics of the institutions.

It's not because there are more bots than humans on their platforms.

It's not because of the psychological damage it causes to adolescents.

It's not because they've killed the individuality given by having your own website, creating an uninteresting homogenous internet.

No, it really isn't because of all of those reasons. I don't have an Instaspam account or an NSABook because they are a huge waste of time, and I have respect for the strength of their algorithms that are used to keep me on the site.

Distributing time between applying and learning to accomplish your goal

Sunday, October 28th, 2018

Let's say you have time t to complete some task g. So for an example we'll say your task is digging a hole that is a cylinder 10m deep with a 1m radius. Given values t and g, what can we say about how much time you should spend learning (i.e. reading a book on how to dig a hole well with a shovel) or applying what you know (grabbing the shovel and digging.)

This is a complex question because often one is not so sure how much can be gained by learning about the subject, if your intuition on how to use a shovel is correct then the book may be a waste of time. However there are a few conclusions and thoughts I've had regarding this problem:

1. As t->0 we want to apply more than we want to learn.

2. As t->infinity it is better to learn than to apply.

3. There is another process one can choose to dedicate time to, merely the one you and i are dedicating time to right now, which is the process of deciding how much time to spend between learning and applying, or in some sense the learning-how-to-learn process. Being stuck in this process could itself be a waste of time, ahh!

In closing, my guesstimate is you should spend 90% of the time learning and 10% applying, all else constant. But you're this question deals with incomplete information, so luck will play a large factor in which decision is correct.

Abstract-Sexpr Tool

Sunday, October 28th, 2018

One process that I want to automate is the process of grabbing an sexpr and turning it into a function. Here is what I do currently manually.

1. I decide that I want to take a block of code inside of a function, and abstract it into a separate function with one or more of the variables inside the sexpr turning into parameters of the new function.

2. I delete the sexpr in emacs (with ctrl-k) and then yank it outside of the original function (ctrl-y).

3. I give the function a name and define it by wrapping the extracted sexpr with

(defun my-new-func-name (param1) (..old sexpr..))

4. I replace the sexpr in the original function with a function call to my-new-func-name with the parameter passed in.

I will try to write this in emacs-lisp and post the code later. I would like to be able to possibly put the cursor on the variable that i want to become a parameter and then have the ability to keep pressing a button going further and further up the sexpr tree until i've reached the root node that i want to be the form that is put into the new function. Ideally with the parens highlighting each time i go up the tree.

Programming in Common Lisp

Saturday, October 27th, 2018

I decided to switch my personal programming language from python -> Common Lisp. This took quite a bit of work, since CL is quite an old school language it uses a lot of conventions not found in modern programming languages. When you search for a solution to a problem in CL you have to really dig or solve it yourself, since it is not a mainstream language that will pop up with hundreds of stack overflow responses after a quick google search. So why did I choose this language?

1. I had been programming in python 2.7 for quite some time and all of the sudden the hype was to switch to python3. This caused many backwards compatibility issues and i saw no reason for the "upgrade". Thus i decided to stick with python2.7, but then I thought to myself, "if a young programmer starts in python3, then someday he will be in my position, except the switch to python2->python3 will now be python3->python4." Thus maybe i am the young programmer whom i am speaking of, and python2.7 is already the unnecessary upgrade of an even older program So i rewinded the clock all the way back till I found Common Lisp.

2. Python does not allow for multiline lambda expressions.

3. Lisp allows for creating code templates with macros. It lets you program in a way not really possible in non lispy languages.

4. Lisp has been around for a while, and it has picked up a few well written libraries over the time. When I look for a solution to a problem I need just one working solution, not 100 working solutions.

5. Lisp programs are easy to send over text communication channels because they can be autoformatted (unlike python).

6. And finally, Common Lisp is used by smart people that I respect.

Guitar Tips

Saturday, October 27th, 2018

A few months ago, a good friend of mine here in Costa Rica let me play his guitar. Since then I've been playing just about everyday, while reading about music theory along the way. Here are my tips to an aspiring guitarist:

1. Do the exercises in Kitharologus: The Path to Virtuosity by Ricardo Iznaola. I have yet to get to even level 1, and I have already seen great improvement in my guitar playing.

2. Learn to breath steadily and properly, this will help you in all walks of life.

3. Keep one finger on the fretboard when you can. This will allow you to play standing up without a strap, as it will give you the leverage to hold the guitar in place. Also, it allows you to keep a more accurate model in your brain of where you are on the fretboard, allowing you to take your eyes off the guitar.