Very Secure

you gotta make room for your new tool in the box

October 29th, 2018

Once upon a time in my life I played chess. I still do on lichess.org 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

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 ()
  (save-excursion
        (forward-list)
    (blink-matching-open)
  (backward-up-list)))

(defun convert-to-funcall()
  (interactive)
  (let (fun-name new-param)
    (save-excursion
      (setq new-param (thing-at-point 'symbol))
      (backward-up-list)
      (blink-list)
      (while (y-or-n-p "go up sexp?")
        (backward-up-list)
        (blink-list))
      (kill-sexp)
      (backward-paragraph)
      (setq fun-name (read-string "Function Name: "))
      (insert "n(defun " fun-name " (" new-param ")n ")
      (yank)
      (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

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

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

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

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

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

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.

No Reason to Switch to mBTC

December 12th, 2017

If we use mbtc colloquially instead of btc then at the current fiatola exchange rate 1mbtc is $17.00, give or take. The argument from the peanut gallery is that this will help people realize that they, too, can afford btc since lo! it is divisible by up to 100,000,000 satoshis. (Well, not really, because of the space required to store the hash of the txn index, but I digress...)

People who have not taken it upon themselves to learn about how divisible btc is have no business buying btc. And btc is for buying houses, not for buying coffee, so no thank you to switching up the nomenclature.

AlphaZero Dubiousness

December 10th, 2017

Call me the konspiracy theorist, but I am very dubious about the publications of Google regarding AlphaGo and AlphaZero. AlphaGo famously beat Lee Sedol in a large heavily publicized show-match. However, as someone who does know Go past the basic rules, I cannot make judgements about the gameplay played at that level. And I wouldn't put it past Google to create a grand sham to dupe its search engine cattle.

Stockfish is impressive because you can download the code, and be amazed yourself on a rudimentary laptop. AlphaN seems to be behind a closed curtain, and we are required to trust an untrustworthy company about the authenticity of their accomplishments.