Sunday, June 18, 2017

Reflections on Kindle books, DRM, Youtube Videos and Music streaming services

Today, I came across an old article I wrote in 2013, more as a note to myself than anything else. As I read it again, I find myself in agreement with my older self. So here it is for anyone that may find it useful ...



Reflections on Kindle books, DRM, Youtube Videos and Music streaming services
Why DRM would never be good enough and why it doesn't make sense for services like Youtube or other music stores which let users stream content, not to allow direct downloads?


Whenever I watch a video on Youtube and would like to save it for later use, but do not find the download button right there, I cannot help but wonder why it isn't there!! Any time I want to watch the video, I can always come back to the website and play it as many times as I would like. When that is the case, doesn't it make more sense to be allowed to download it right on the first occasion, saving bandwidth and resources on both sides, and reducing the CO2 footprint? Ahh!! There are concerns of intellectual property rights. And then there is advertising revenue. And a whole lot many reasons which make all of our lives complicated. Same with music streaming services.

Now let's turn our attention to ebooks, specifically, Amazon Kindle books. So I purchase an ebook, and I have to read it through the kindle app. Somehow, I've always been skeptical of keeping my books and the ability to read them at the beck and call of a third party. How can I be sure that tomorrow I won't lose my Amazon account or that Amazon will not go bonkers and start deleting books on my account, thereby preventing me access to all my important books, and the even more valuable notes and comments that I make on them? So I started looking at ways to save my books so that I'll be able to access them independently of any third party. Sure enough, there are ways to deDRM the ebooks. But with time, Amazon changes the encryption algorithms, the keys used for encryption and so on. Every time a key or an algorithm is broken, a new one takes its place. So the deDRM process is continuously evolving and so, this I can't trust to always work. Is there any other way I can accomplish the task?

Like a publisher would always like to protect his intellectual properties, the same way, every bit of notes and comments I make on my texts is my own intellectual property, and more often than not, the comments are even more valuable to me than the texts themselves. So I must find a way to protect my intellectual properties not just for a few years for which amazon claims I rent the kindle book, but forever. What do I do then?

Well, supposing I have a hard copy textbook and I write comments upon it, in order for this to be saved, I can make a photocopy. And now, there is an electronic equivalent for the same. And this we can always trust to work, irrespective of what Amazon or Government or anybody else wants.

Open your ebook on the kindle app in full screen mode. Go to the first page. And print screen. Move to the next page, print screen. This way you have the entire book photocopied. Now automate the next page move and print page commands. And you can have the whole pdf!! Isn't this simple ? Does this not work?

Let's see.
I used an Ubuntu system. Login through Amazon cloud reader. Open a book you own. Go the first page. Set the font size appropriately and go to full screen mode.

Now Alt+Tab and open a terminal and run the following.

sleep 10; while true ; do gnome-screenshot ; xdotool key Down; sleep 1 ; done

Alt+Tab and go to the cloud reader in full screen mode.

The script simulates whatever a genuine reader does. It takes a screen shot of the page, then simulates a right arrow key press. This will take you to the next page. The screen shot is captured again and then it moves to the next page and so on. We may also choose to simulate mouse click operations in place of key press.

Ideally the loop needs to run for as many times as there are pages in the book. But because this is not exactly clear with different font sizes, I let it run forever. Whenever the last page is reached, it is being recaptured again and again. At that point, Alt+Tab to terminal. Ctrl+C .

Now go to ~/Pictures (where gnome-screenshot is captured) and remove the redundant images at the end of the list. (Also make sure this directory is empty before the process starts.)

cd ~/Pictures

# batch convert png screenshot files to pdfs
find . * -exec convert {} {}.pdf \;

# check that these two numbers match
ls *.png | wc -l
ls *.pdf | wc -l

#combine pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=outputfilename.pdf -dBATCH *.pdf

The outputfilename.pdf is the required pdf file. If you like, you may run this through OCR. I used XChange Viewer on Ubuntu.
Now we have everything we need.

Now supposing Amazon knows somebody is doing this. What can they do? They may change the way in which the display shifts from one page to another, and how the user interacts. And because this involves end user interaction, they can never make it very complicated. And so the script which can be modified to always simulate whatever the user has to do, would never itself get very complicated.

Supposing they somehow manage to disable screen capture itself, although I do not quite see how they can do that on anything other than a kindle. I'll run the whole app on a virtual machine and capture screen from outside. Supposing they somehow overcome this also, the worst I can resort to is install a camera in front of my computer and that'll do the screen capture for me. The point is that it can always be done. Period.

This is not a tutorial on how to copy DRM protected ebooks. But on how it isn't a valid idea to cripple usability for the sake of centralized control, intellectual right protection etc. when that itself can never be achieved. A sane user will always find a way out.


As for Youtube, can I not video capture my screen? Better, allow downloading directly as the videos themselves are free to watch over the web! Same is not the case with ebooks which publishers and authors would like to sell. For that, DRM alone does nothing more than try to achieve security through obscurity. And not much else. Can you ever prevent a hard copy of a text from being photocopied? It's like trying to secure communication between two parties when one of them is inherently compromised.



PS: Sure enough, the automation script can be improved, and made more user friendly, but you get the idea!

Wednesday, March 13, 2013

The Law of Liberation As explained by Lord Vishnu to Garuda


An Account of the Law for Liberation. 


1-4.  Garuda  said:  I  have  heard  from  you,  O  Ocean  of  compassion,  about  the transmigrating of the individual, through ignorance, in the worlds of change. I now wish to hear about the means for eternal liberation.
O Lord, O Ruler of the Shining Ones, compassionate to those who seek refuge,--in this terrible world of change, in the unsubstantial, in all deep miseries,
The endless multitudes of individuals, placed in various kinds of bodies, are born and die - of them no end is known.
Always miserable in this world, no one is ever known to be happy. O Lord of Liberation, tell me by what means they may obtain release, O Lord.

5-7. The Blessed Lord said: Listen, O Tarksya, and I will explain to you what you have asked, even by the hearing of which a man is released from the world of change.
There is a Shining One, Śiva, who has the nature of Supreme Brahman, who is partless, all-knowing, all-doing, Lord of all, stainless and secondless,
Self-illumined, beginningless and endless, beyond the Beyond, without attributes, Being and Knowing and Bliss. That which is considered the individual is from a part of Him.

8-10 These, like sparks of a fire, with beginningless ignorance, separated and encased in bodies by beginningless karma,
Are fettered by forms of good and evil, giving happiness and misery,--with nationality of body, length of life, and fortune born of karma.
In every life obtained. They have also, O Bird, a higher and more subtle body, the liṅga, lasting until liberation.

11-13. The unmoving things, worms, goats, birds, animals, men, the righteous, the thirtythree deities, and also the liberated, according to their order,
Having worn and cast aside the four sorts of bodies thousands of times, one becomes a man by good deeds, and if he becomes a knower, he attains liberation.
The embodied, in the eighty-four hundred thousands of bodies before attaining human birth, can obtain no knowledge of the truth.

14-16.  Through  millions  of  myriads  of  thousands  of  births  some  time  a  being  obtains human birth, through the accumulation of merit. He who, having obtained a human body, difficult to get, and a step to liberation, does not help himself over,--who in this world is more sinful than he?
The man who, having obtained this highest birth and superior senses, does not understand what benefits the soul is a slayer of Brâhmaṇ.

17-19.  Without  a  body,  nobody  obtains  the  object  of  human  life;  therefore  should  he guard his body as wealth and perform meritorious deeds.
He should always guard his body, which is the means to everything. Living, he should make every effort to protect it, in view of welfare.
A village again, a field again, wealth again, a house again, good and evil actions again - the body never again.  1

20-21.  The  wise  always  adopt  means  for  the  preservation  of  the  body;  even  those afflicted with diseases such as leprosy do not wish to give it up.
It should be guarded for the sake of duty; duty for the sake of knowledge; knowledge for the sake of Yoga-meditation,--then he is soon released.

22-23. If he does not guard himself against harm who else will? Therefore should he look after his own benefit.
He who does not take precautions against the diseases of hell while here; afflicted with disease and having gone to a country where there is no medicine, what will he do?

24-25. Old age comes on like a tigress; life goes like water from a broken pot; diseases attack like foes. Therefore should he strive for the best.
So  long  as  misery  does  not  come,  so  long  as  calamity  does  not  befall,  so  long  as  the senses are not decayed, so long should he strive for the best.

26-32. So long as the body lasts, so long should truth be pursued,--the stupid man digs his well when the corner of his house is already afire.
The time of death is not known by those who are variously embodied in the world of change. Alas! a man, between happiness and misery, does not know his own benefit.
Though seeing those just born, the afflicted, the dead, those whom calamity has befallen, and the miserable, people are never afraid, having drunk the liquor of delusion.
Riches are like unto a dream; youth is like a flower, life is fickle as lightning,--where is there a discerning one who is at ease?
Even a hundred years of life is very little, and half of it is sleep and idleness, and even that little is unfruitful owing to the miseries of childhood, disease and old age. He does not do what ought to be done; when he should be awake he sleeps; where he should fear he confides. Alas! what man is not stricken.
How  shall  the  individual  who  has  taken  a  body,  which  is  like  foam  on  water  and  is attached to passing objects, be free from fear?

33-35. He who does not know what is good for him thinks the harmful beneficial, the impermanent permanent, and the evil good;
Though seeing, he falters; though hearing, he does not understand; though reading, he does not know; bewildered by the divine magic.
This  universe  is  immersed  in  the  boundless  ocean  of  death,--though  grasped  by  the crocodiles of death, disease and old age, he does not understand.

36-38. Time, though wearing away with every moment, is unnoticed, just as an unbaked pot placed in water disappears imperceptibly.
Air  may  be  enclosed,  ether  may  be  split;  waves  may  be  bound,--life  cannot  be  made permanent.
Earth is burnt away by time; even Meru is reduced to powder; the water of the ocean is dried away--what shall be said of the body?

39-41.  The  wolf  of  death  forcibly  slays  the  lamb  of  a  mortal,  who  prates  of  "my offspring; my wife; my wealth; my relatives."
"This has been done; this is to be done; this other is done or not done." Him who is thus prating death overpowers.
"It must be done to-morrow; it must be done to-day; in the morning or in the afternoon,"- death does not consider whether it leas been done or not done.

42. Thou shalt encounter the enemy, death, whose, coming is shown by age, who has an army of dreadful diseases--wilt thou not see the saviour?

43-44. Death preys upon the man afflicted with the needles of thirst, bitten by the serpent of sense-objects, and baked in the fire of desire and repulsion.
Death attacks children, young men, the old, those in the embryo condition,--such is this world of creatures.

45-48. This individual, leaving his own body, goes to the abode of Yama. What is the good of association with wife, mother, father, son and others?
The world of change is verily the root of misery. He who is in it is afflicted with misery.
He who abandons it becomes happy,--otherwise never. This world of change, which is the source of all misery, the seat of all calamities, and the refuge of all sins, should be abandoned at once.
A man bound in fetters of iron or wood may be released, but from the fetters of son and wife can never be freed.

49-51. So long as the being makes attachments pleasant to the mind, so long shall the dagger of sorrow pierce his heart.
People are destroyed every day by the desire for great wealth. Alas! Fie upon the foods of the senses, which steal away the senses of the body.
Just as the fish, covetous of flesh, does not see the iron hook, so the embodied, covetous of pleasure, does not see the torments of Yama.

52-55. Those men who do not understand what is good and what is not good for them, who constantly pursue evil courses, and are intent on the filling of the belly, are destined for hell, O Bird.
Sleep,  sexual  pleasure,  and  eating  are  common  to  all  creatures.  Who  possesses knowledge is called a man, who is devoid of it is called a beast.
Foolish  men  are  tormented  at  break  of  day  by  nature's  calls;  when  the  sun  is  in  the meridian by hunger and thirst; in the night by passion and sleep.
All those beings who are attached to their bodies, wealth, wife and other things, are born and die deluded by ignorance, alas!

56-57.  Therefore  should  attachment  be  shunned  always,  It  is  not  possible  to  give  up everything.  therefore  should  friendship  with  the  great  be  cultivated,  as  a  remedy  for attachment.
Attachment  to  the  good,  discrimination,  and  purity  of  the  eyes--the  man  who  has  not these is blind. How shall he not tread evil ways?

58. All those deluded men who turn away from the duties of their respective castes and orders, and do not understand the highest righteousness, perish fruitlessly.

59-60.  Some  are  intent  upon  ceremonies,  attached  to  the  practice  of  vows;  with  self enveloped in ignorance the imposters go about.
The men who are attached to the ceremonial alone are satisfied with mere names, deluded by the repetitions of mantras, oblations and other things, and by elaborate rituals.

61-62. The fools, bewildered by My magic, desire to obtain the invisible by single meals, fasts and other restraints, and by the emaciation of the body. Of  those  who  have  no  discrimination,  what liberation  can  there  be  by  bodily  tortures alone? What great serpent is killed by beating the anthill alone?  1

63. The hypocrites, putting on appearances, and wearing quantities of matted hair, and using antelope skins, wander about like knowers, and even delude people.

64. He who is attached to the pleasures of the worlds of change, saying "I am a knower of Brâhmaṇ,"  and  is  devoid  of  both  rites  and  Brâhmaṇ  should  be  shunned  like  a  low outcaste.

65-69. Donkeys walk about among people, in forests and among houses, quite naked and unashamed. Are these free from attachment?
If men are to be liberated by earth, ashes and dust, does the dog which always live among earth and ashes become liberated?
The jackals, rats, deer and others, which feed upon grass, leaves and water, and always live in forests,--do these become ascetics?
The  crocodiles,  fishes  and  others,  which  from  birth  to  death,  dwell  in  the  waters  of Ganges,--do these become Yogins?
Pigeons at times eat stones, and Châtaka birds do not drink water from the earth,--are these observers of vows?

70. Therefore this class of practices is a thing which makes pleasure for people, O Lord of Birds,--direct knowledge of the Truth is the cause of liberation.

71-73.  Fallen  into  the  great  well  of  the  six  philosophies,  1   O  Bird,  the  brutes  do  not understand the chief good; bound in the snare of animalism.
They are tossed hither and thither in the dreadful ocean of Vedas and Śâstras; caught in the six waves they remain sophists.
He  who  knows  the  Vedas,  the  Śâstras  and  the  Purâṇas,  but  does  not  know  the  chief good,--of that imitator all this is as the speech of a crow.

71-76. "This is known; this must be known,"--thus bewildered by anxiety they read the scriptures day and night, turning away from the highest truth.
The fools, decorated with garlands of poetry constructed of forms of speech, miserable with anxiety, remain with senses bewildered.

76-77. Men trouble themselves variously, but the highest truth is otherwise; they explain in different ways but the best purport of the Śâstras is otherwise. They talk of the highest experiences, not realising them themselves. Some have ceased preaching, being engrossed in egotism.

78-82. They repeat the Vedas and the Śâstras, and argue with one another, but they do not understand the highest truth,--like the spoon the flavour of the food.
The head bears flowers, the nostril knows the smell. They read the Vedas and the Śâstras, but find impossible the understanding of the truth.
The fool, not knowing that the truth is seated in himself, is bewildered by the Śâstras,--a foolish goatherd, with the young goat under his arm, peers into the well.
Verbal knowledge cannot destroy the illusions of the world of change,--darkness never disappears by talking of a lamp.
Reading, to a man devoid of wisdom, is like a mirror to the blind; hence, for those who have understanding, Śâstras are only a potter to the knowledge of the truth.

83-84. "'This is known; this must be known,"--he wishes to hear everything. If one lives for a thousand celestial years he cannot reach the end of the Śâstras.
The  Śâstras  are  numerous;  life  is  brief;  and  there  are  tens  of  millions  of  obstacles; therefore the essence should be understood,--like the swan taking the milk in the water.

85-86. Haring practised the Vedas and the Śâstras, and having known the Truth, the wise man should abandon all the scriptures; just as one rich in grains abandons the straw.
Just as there is no use for food to one who is satisfied with nectar, so is there not use for the scriptures, O Târkṣya, to the knower of the Truth.

87-88. There is no liberation by the study of the Vedas, nor by the reading of the Śâstras. Emancipation is by knowledge alone, not otherwise, O son of Vinatâ.
The  stages  of  life  are  not  the  cause  of  liberation,  nor  are  the  philosophies,  nor  are actions,---knowledge only is the cause.

89-90. The word from the Teacher gives liberation; all learning is masquerade. Among thousands of woods the Sañjîvana  1  is best.
The non-dual, verily declared auspicious, is beyond efforts of action, and to be obtained by the word of the Teacher, not by the study of tens of millions of texts.

91. Knowledge is said to be of two kinds: study and discrimination. The study is of Śabda Brâhmaṇ; Para Brahmaṇ is reached by discrimination.

92. Some prefer the Non-dual  2 ; other prefer the Dual  3  but they do not understand the One Reality, beyond the Dual and Non-dual. 93-94. Two phrases make for bondage and liberation: "Mine" and "Not-mine." The being saying "Mine" is bound; saying "Not-mine" is released.
That is the karma that does not bind, that the knowledge that gives release; other karma is worrying, other knowledge is skilful chiselling.

95-97.  So  long  as  actions  are  performed;  so  long  as  the  impressions  of  the  world  of change remain, so long as the senses are fickle; so long how can there be realisation of Truth?
So long as there is pride of body; so long as there is the sense of "mineness," so long as there is excited striving; so long as there is imagination of plans;
So  long  as  there  is  not  stability  of  mind;  so  long  as  there  is  no  meditation  upon  the Śâstras, so long as there is no love for the Teacher; so long how can there be realisation of Truth?

98-99.  So  long  as  one  does  not  reach  Truth,  so  long  should  he  do  austerities,  vows, pilgrimage to sacred waters, recitations, oblations, worship and reading of the prescribed texts of the Vedas and Śâstras.
Therefore,  if  one  desires  liberation  for  himself,  O  Târkṣya,  he  should  every  effort, always, and under all circumstances he attached to Truth.

100. One who is tormented by the three miseries and the rest, should resort to the shade of the tree of Liberation, whose flowers are righteousness and knowledge, and fruits are heaven and liberation.

101. Therefore from the mouth of the Blessed Teacher the Truth of the self should be known. By knowledge the being is easily released from the awful bondage of the worlds of change.

102. Listen! I will tell you now about the final actions of the knower of the Truth, by which he obtains liberation, which is called the Nirvâṇa of Brâhmaṇ.

103-107. His last days approaching, the man, rid of fear, should cut off, with the sword of unattachment, the desires connected with the body.
Courageously  wandering  from  home,  performing  ablutions  in  the  water  of  the  holy bathing places, sitting alone on a pure seat prepared as prescribed,
He  should  practise  mentally  upon  the  supreme  three-fold  pure  Word  of  Brahmâ.  He should, with breath controlled, restrain his mind, not forgetting the Brahma Bîja.  1
With reason for charioteer he should withdraw the senses from the sense-objects by the mind,  and  should  fix  his  mind,  drawn  away  by  karmas,  with  understanding,  upon  the pure. "1 am Brâhmaṇ, the Supreme Abode; I am Brâhmaṇ, the Highest Goal,"--having realised this and placed the self in the self he should meditate.

108.  He  who,  when  leaving  the  body,  utters  the  one-syllabled  Brâhmaṇ,  "Oṁ," remembering me, goes to the Highest Goal.

109-110. The hypocrites, devoid of knowledge and unattachment, do not go there. I will tell you about the wise, who go to that goal.
Free from pride and delusion, with the evils of attachment conquered, always dwelling in the Higher Self, with desires overcome, released from the contracts known as pleasure and pain, they go, undeluded, on that eternal path.

111-114. He who bathes in the water of the Mânasa,  1  which removes the impurities of attraction  and  repulsion,  in  the  lake  of  knowledge,  in  the  waters  of  Truth,--he  verily attains liberation.
He who, firm in non-attachment, worships me, thinking of no other, full-visioned, with tranquil self,--he verily attains liberation.
He who, expecting to die, leaning his home, dwells at a sacred bathing-place, or dies in a place of liberation, he verily attains liberation.
1.Ayodhyâ,    2   Mathurâ,  3   Gayâ,  4   Kaśî,  5   Kañchi,  6   Avantikâ,  7   Dwârâvatî,  8 --these  seven cities should be known as the givers of liberation.

115. This eternal way of liberal in al has been described to you, O Târkṣya,--hearing it with knowledge and dispassion one attains liberation.

116. Knowers of Truth attain liberation; righteous men go to heaven; sinners go to an evil condition; birds and others transmigrate.

117.  Thus  in  sixteen  chapters  I  have  related  to  you  the  extracted  essence  of  all  the scriptures. What else do you wish to hear?

118-120. Sûta said: Having thus heard, O King, these words from the mouth of the Lord, Garuḍa, repeatedly prostrating himself, said this, with hands folded together:--
"O Lord, O God of Gods, having heard these words of nectar I have been helped over the ocean of existence, O Lord, O. Protector!
"I stand freed from doubts. My desires have been completely fulfilled." Having said this, Garuḍa became silent and lost in meditation.

121.  May  Hari,  the  remembrance  of  whom  removes  evil,  who  gives  the  condition  of happiness for the sacrifice of worship, and who gives liberation for supreme devotion to Him,--protect us.

(From  The Garuda Purana With English Translation by Ernest Wood and S.V.Subramanyam, 1911)

Friday, February 15, 2013

About Creation



"Why God has created this beautiful universe has been a question asked for thousands of years. The reason is very simple to understand: this beauty that is created cannot see itself. In the same way, God who is the source of beauty, beauty cannot see its own beauty. Like a pearl cannot enter into itself to see its beauty. Like the sky cannot understand its own beauty. The stars cannot see their own beauty. The Sun cannot behold its own brilliance. In the same way God Almighty cannot behold His own being. He needs a mirror. And that is how He has created this beautiful universe as His mirror. In this mirror He has created now beautiful things like the Sun. The Sun has to see his own reflection also. So He has created these beautiful trees to see that when he shines they come up so well and look so green. 
  
Then He has created those birds to rise early in the morning to greet the Sun, so the Sun knows that, Yes, I am there, I am existing; or else He has created these beautiful lakes for these trees to see their reflection and the lakes to feel their existence when the ripples start moving within themselves. So then He created human beings. The human beings cannot also see their own beauty, their own glory. That is why they are in the darkness. They are ignorant. They cannot see what lies within themselves. So they are running after something which is absolutely against themselves, which is ugliness, which is self destructive. And the struggle to get to reality is such a lot that as a result they destroy themselves. Like as people have taken to these drugs, taken to all bad habits of this place they say a lot of smuggling going on and all such endeavors that people take up because they do not know what beautiful things they are. 

So now a mirror has to be created for them, to see for themselves how beautiful they are. Their mirror is their Spirit. That Spirit is to be brought in their consciousness, in their attention. If it comes in their attention then they can see their image. Now this attention that comes in, is the expression of the attention which is enlightened. But it is also said that it is got a nature, which is very transitory, or, we can say, which is disappearing every moment to moment. When this is happening what is to be done? For that you have to steady yourself with meditation, with hearing the enlightened talks, by seeing the good things of life without thinking about them, by seeing also the goodness of others and then you start seeing goodness in yourself also. 

That is why I always say that one should not feel guilty, because you are feeling guilty of something, which is just, just an illusion. You are guilty that you have got a shadow. It is something like that. So if you know that you are beautiful beings and that you have got a shadow is nothing to do with you and your beauty. If you can see you own beauty then you will be amazed that within us lies all those joy giving, all those beautiful things, which we are seeing outside; but just now the mirror is not all right, that is why you have to see the nature and the beauty. But, when you are one with yourself then you see all these nature within yourself, all the joy giving qualities of this nature within yourself. 

So I wanted you to come to this place just to learn how God has created this beautiful area for you people to enjoy and to be here. 

May God bless you!"

Shri Mataji Nirmala Devi, Alibag, India, 21 December 1986.