Wednesday, August 31, 2016

Some thoughts on blockchain technology

We want things to be incorruptible - an incorruptible government, an incorruptible and unbiased legal system, incorruptible private companies that behave strictly according to the rules they committed to.
But people are naturally corruptible, and naturally tempted to take advantage of a position of power..
and sometimes people are just bad at keeping track of the rules they should be following, not out of bad intentions, but just out of boredom and laziness or busyness.

A natural solution that comes to mind, sounding perhaps a bit like something from a science fiction story, is to have a computer program run a company, a bank, or the world?..or just start small and have a computer program enforce a legal contract between two people so that they would not have to worry about trusting the other.

As a side note, Uber was supposed to start using self-driving cars this week in Pittsburgh, so we are definitely living in the science fiction era.

As any one who has programmed has experienced, once a computer program is executed it will stick to the rules it was given, even when they have absurd consequences.

This was how roughly 150 million dollars were stolen in the DAO smart contract.
http://www.coindesk.com/understanding-dao-hack-journalists/

DAO stands for Distributed Autonomous Organization and this was the first large scale attempt to have a computer program run a company.

..but wait - you want to have a computer program be in charge to avoid corruption,
but can't the person in control of the computer just change or stop the program?

The solution to this is to use the whole internet as one big computer..
in a way that you can execute the next step of the program only if the majority of the internet, which we assume is not all colluding together in bad intent, agree that - yes, this is indeed the next line of the program.

The bitcoin protocol gave an ingenious way to have a vast number of computer work together without a minority among them being able to mislead the others regarding what the current state of the program is.

Monday, July 11, 2016

Spiritual practice is the practice of boredom.
Liberation is not necessarily the right for free speech, free sexuality,
free internet..but the right to be bored.
Say you saw a man or women running around all day, frantically performing
various tasks and errands that seemed urgent, although it was not always
clear if they were important;
and say every time he or she stopped to rest, for just a moment,
they were almost immediately whipped.
You might call that person a slave.
But, I know at least from my experience, that a moment without stimuli,
sitting with no movement, eyes closed, no smartphone, no food, no laptop,
is enough to get mentally whipped from within.
Are we whipping ourselves, or is it some demon from another world? That's
just semantics maybe..
Usually, we reach so fast for the smartphone or a piece of food,
that we don't even notice or remember it is to avoid the whipping.
But the counter-intuitive fact, that is forgotten again and again,
is that we are strong and our master is weak. When you keep sitting, just
feeling the lashes, resisting the urgent call ``new stimulus now!!', the lashes
grow weaker exponentially fast.
Within a few minutes you feel a bliss that evaded you all day when you
were running around trying to make everything perfect.
Why would there be bliss when doing nothing?
Suppose there was a huge ocean, and in that ocean a bottle.
Very quickly the bottle is filled with water.
And suppose that the water drops that got swept into the bottle started
thinking ``I am bottle''.
``I am a small fragile individual in this huge scary dangerous ocean''.
It would be quite stressed out, and it would even forget the basic reason
why it is stressed out, and blame its discontent on trivial matters
and disputes with other bottles.
But then..say after years of thinking this way,
the water drops had a glimpse of the truth
``Wait a second, we're just water drops that happen to be inside this bottle right now,
and if anything happens to the bottle, we'll just be water drops outside of the bottle..
so what's to be so worried about?''
Imagine, the relief a water drop would feel at such a moment.

Likewise, a few consciousness particles, in a sea of consciousness
particles, floated inside a temporary container,
and started thinking, I am this container.
But a few minutes with no stimulus are sometimes enough to feel -
nothing here but consciousness particles floating around.

Friday, March 04, 2016

Something I find very exciting. Much more than these silly gravitational waves (only physicists can spend a billion dollars to generate spikes on a graph ;) ).
The first Zero-Knowledge Contingent Payment was successfully carried out on bitcoin. Suppose I have some valuable information I want to sell you.
So we have a chicken and egg problem - I can either send the information first, and then you might not pay; or you might send the payment first and I will not send the information (I may be lying about having it in the first place)
Greg Maxwell, one of the main developers of bitcoin, described a clever method where either both things happen at once, or don't happen at all.That is, either both money and information changed hands, or neither.
You can think of the method roughly like this. The seller generates a digital key.
At first this key is useless. But then through a process involving the bitcoin network, and something called zero-knowledge proofs, this key is given the power to unlock doors to two rooms - one containing money that the buyer stored for the seller, and another containing the valuable information the buyer wants. Well, by this description you could think, the seller can now only unlock the door containing the money. But the way this is implemented, unlocking that door corresponds to publishing the key on the bitcoin network, after which the buyer can use the key to unlock the second door and get what he paid for.
In a recent conference, a contingent payment was used for the first time to buy a solution to a sudoku puzzle for 0.1 bitcoin - about 40 dollars :)
https://bitcoincore.org/en/2016/02/26/zero-knowledge-contingent-payments-announcement/

Tuesday, March 01, 2016

Raise the Bar

You can't improve what you don't measure, I heard once.
Many times in life there is a conflict between what's good in the short term,
and the long term, or even just slightly longer term.

Supposedly, some people are better than others at thinking about the long term.
But I think of it differently (intentionally oversimplifying): All humans are equally incapable of being motivated by anything except what feels good now;
but humans vary significantly on their ability to generate short term emotional rewards,
for performing a ``not fun'' activity that is good for the long term.

For example, while small kids rarely enjoy brushing their teeth,
by adulthood we can enjoy the physical sensation of cleanliness during and after the brushing.
Once we learn to enjoy it, the brushing does not really require `sacrificing the short term for the long term'.

I've been working with an app called Raise The Bar that helps me give myself immediate emotional rewards for positive long term behaviors.

Basically, each time you do the positive behavior, e.g., a push-up,
you get to press the up-arrow of the push-up bar on your app




https://play.google.com/store/apps/details?id=com.lvl.xpbar&hl=en


You can define a daily goal you want to get to - like 35 push ups, or 2 hours meditation in my case.
Or you can just use a progress bar, that measures, say, from now onwards, how many pullups have you done in your life.
When you choose to use this progress bar, you can progress up levels, where each time you need to do more repetitions to get to the next level.
For example, 5 pull-ups suffice to go from level 1 to 2, but to get from 2 to 3 you'll need 10.

You can also use timers.
For example, I make a goal of spending a total of 1 hour cleaning the house each week.
Each time, I do a one minute mini-clean - taking out the trash, or picking something from the floor,
I activate the timer, and see my percentage go up a bit more towards the goal

You can track goals of avoiding certain things as follows:
You can track  ``days without activity X'', where I take X for example to be more than 60 minutes of non-work related internet, and for each day you managed to maintain that you raise the bar by one.
Then you can set a goal of, say, having at least 25 such days till the end of the month.

Yesterday, I went to the beach near my house,
got a (soy-milk) cappuccino,
went to the exercise area;
and did reps of 5 pull-ups, 10 push-ups, and 3-5 meditation

Having the constant feedback of pressing the up-button on the app, and seeing your stats go up makes it more fun.

Friday, February 19, 2016

Off topic, but my favorite GIT tips

You're not a real programmer until you've had a nervous breakdown by accidentally erasing your files with git,
or at least had a nervous breakdown from some other git-related reason.
But perhaps there is no point in 5 or more git-triggered nervous breakdowns.
My favorite tips, so I won't forget:

add all and commit in same line:
git commit -am "bla"

Note: Something I've understood while writing this. What is the "all" in "add all"?
All files in the directory? No! It's all files that are currently *tracked*.
As I understand, this means files you have added manually, i.e. used
git add filename
at some point in the past.
You can stop a file from being tracked by
git rm --cached filename
(If you don't use --cached file will actually be erased!)

change a commit name after you've called it ``fuck git'':

git commit --ammend -m "hug git"


Save before pulling! Otherwise this could happen:
You pull, before you've saved a file.
When you go back to the editor it asks
you ``The file has changed, do you want to save this one?"
Instinctively, you say yes..
Now git thinks your old file, contains newer updates than
what you've just pulled!
If you retry to merge, it will just give you your old file, cause it think it's newer..
actually wonder if someone had solution for this?


You've done a lot of nonsense, and just want to go back to state at last commit without saving anything:

git reset --hard.

You've done a lot of nonsense, commited it. You want to go back to the state you were in 2 commits ago, but want to save what you have cause some of this nonsense might be useful someday:

git branch wip
git reset --hard HEAD~2

To prove the point of this post - I did accidentally erase some work while trying the above lines:
After I created the branch wip, I assumed it had all my latest work. - but I did not *commit* before running the first line. So branch wip had my latest *comitted* work.
And when I ran the second line, my newest changes after my latest commit where erased for good as far as I know. arghhh    gotta be careful with that --hard flag
In this context
Save before any git operation!! or weird shit will happen!

You want to see what's different now compared to j commits ago (This *includes changes you've made you haven't committed to)

git diff HEAD~j

You want to see what's different in the latest commit, compared to 4 commits ago:

git diff HEAD HEAD~4

You just want to see  what's changes since you've last commited

git diff

You want to temporarily go back to the situation you were in 3 commits ago, without actually changing anything about the branches

git checkout HEAD~3

Stuff I've just learned: You want to go back to a commit, but without deleting the history, rather by adding a new event in the history that you have gone back:

Say you had commits titled


You've come to the conclusion you prefer to fuck git, but don't want to erase the memory of a nicer time. So you use revert as follows:



Now you feel like you just want to erase all the emotions you went through,
and leave only that first moment, so you use reset as follows

Warning: If you try to use git revert on complex projects. where there have been merges, weird shit happens that I am working on understanding





Blog Archive