<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ronnie Paskin on Medium]]></title>
        <description><![CDATA[Stories by Ronnie Paskin on Medium]]></description>
        <link>https://medium.com/@rpaskin?source=rss-21e54d4d6e71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*5V1PVlRF5oQjFvZR50zysQ.jpeg</url>
            <title>Stories by Ronnie Paskin on Medium</title>
            <link>https://medium.com/@rpaskin?source=rss-21e54d4d6e71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:20:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rpaskin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Os Turcos em Lã]]></title>
            <link>https://rpaskin.medium.com/os-turcos-em-l%C3%A3-e2274b5fd3c9?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2274b5fd3c9</guid>
            <category><![CDATA[fake-news]]></category>
            <category><![CDATA[bots]]></category>
            <category><![CDATA[social-media]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Tue, 18 May 2021 21:51:18 GMT</pubDate>
            <atom:updated>2021-05-18T21:51:18.910Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*LFpACPmPh7hcT9gE.jpg" /><figcaption>Gravura do livro: Karl Gottlieb von Windisch, <em>Briefe über den Schachspieler des Hrn. von Kempelen, nebst drei Kupferstichen die diese berühmte Maschine vorstellen.</em> 1783. Fonte: wikipedia</figcaption></figure><p>No final do século XVIII, o autor e inventor húngaro Wolfgang von Kempelen construiu um autômato jogador de xadrez. Este <em>Turco Mecânico, </em>era uma máquina elaborada. Movida por um conjunto de engrenagens, cintas, molas e afins, esse aparato conseguia mover peças de xadrez em um tabuleiro, jogar, e até mesmo vencer pessoas no jogo.</p><p>Esse robô mecânico, justificadamente, impressionou até imperadores. Uma maravilha da tecnologia, quiçá até do oculto, já que muitos atribuíam à máquina feitos aparentemente sobrenaturais.</p><p>Como um mecanismo desses poderia ter essa inteligência? Será que é possível? Por mais que seja natural para o ser humano cogitar, a resposta, também naturalmente, muitas vezes é bem mais simples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wXx8_JgHg8JBnlrc.jpg" /><figcaption>Uma tentativa de mostrar uma vista de corte de como o operador se posicionaria na máquina. Fonte: wikipedia</figcaption></figure><p>A máquina não passava de uma ilusão. Um operador, escondido dentro da máquina, era quem fazia as peças se mexerem. A inteligência vinha dele, e não dos mecanismos que ele controlava.</p><p>O feito era uma ficção, mas o efeito era real. Afetou até as pessoas mais cultas, influentes e poderosas. O turco mecânico chegou a fazer um tours pela Europa e mundo afora. Vienna, Paris, Londres… até mesmo Benjamin Franklin ficou impressionado.</p><p>O próximo autômato a competir com pessoas surgiu séculos depois. Nos anos 2000, o <em>Deep Blue</em>, sistema computadorizado da IBM se tornou capaz de, agora realmente, competir e ganhar de humanos.</p><p>Mas os Turcos Mecânicos não desapareceram, eles evoluíram. Mesmo na época da Inteligência Artificial, certas tarefas (por enquanto) ainda são feitas melhor por seres humanos: reconhecimento de imagens, interpretação de textos, moderação de conteúdo, entre outras.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*ZNt0dLWHWml6WPdN.png" /><figcaption>exemplo de CAPTCHA com reconhecimento de texto</figcaption></figure><p>Toda vez que respondemos um CAPTCHA (“<em>Completely Automated Public Turing test to tell Computers and Humans Apart</em>”, ou “Teste de Turing Completamente Automatizado para diferenciar Computadores de Humanos”), por exemplo, estamos servindo como turcos mecânicos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*yNIjeXGYI4m7iavB.png" /><figcaption>exemplo de CAPTCHA com reconhecimento de imagens</figcaption></figure><p>Sabendo disso, a empresa Amazon re-empacotou os turcos mecânicos. Ao invés de escondidos dentro de autômatos, desta vez eles estão atrás de teclados e mouses.</p><p>A <a href="https://www.mturk.com/">Amazon Mechanical Turk</a> é uma plataforma de crowdsourcing em que pessoas podem assumir tarefas dentro de uma cadeia de processos, e serem pagas por esse trabalho.</p><p>Mas, com certeza, certas coisas são ainda domínio exclusivo dos humanos, não? Nada mais humano que redes sociais, tão relevantes no século XXI. Afinal, é auto-evidente. Um computador ou robô não se socializa dentro de uma sociedade, pelo menos por enquanto.</p><blockquote>“Dar às pessoas o poder de criar comunidades e tornar o mundo mais próximo uns dos outros” (tradução livre de “ <em>Give people the power to build community and bring the world closer together</em>”) — Mark Zuckerberg, fundador do Facebook</blockquote><p>Criaram-se comunidades. Pessoas de grupos diversos, que muitas vezes antes tinham dificuldade em achar seus pares, puderam se encontrar virtualmente pelas redes sociais, articular suas opiniões, se identificar, se fortalecer, recrutar novos membros… Desde grupos de caridade, ação social, apoio psicológico, até extremistas e fundamentalistas de diversas linhas.</p><p>Em uma reviravolta que talvez possa se chamar perversa, diversos desses grupos hoje manipulam redes sociais “impulsionando” seus tópicos de interesse para ecoar no <em>gestalt</em> das redes. Existem diversas técnicas, algumas simples, como a compra de anúncios, a criação de sites apontando uns para os outros e até mesmo postagens automáticas para perfis falsos. Outras técnicas são mais complexas e bizarras.</p><p>Alguns destes perfis falsos participam ativamente de redes sociais. São mantenedores e participantes de “comunidades” como grupos em sites e aplicativos, por exemplo, o WhatsApp. Muitas vezes postam coisas inócuas, piadas, memes, para se manter relevantes. Por diversas vezes outros perfis falsos emulam seguidores dos primeiros ou dos grupos. Por conta do anonimato e a dificuldade para as pessoas em geral de saber quem é uma pessoa ou não, ajudam esses perfis a terem um “capital social” e serem percebidos com “relevantes” de alguma forma.</p><p>Quando eventualmente criam (ou calham de achar) algo que realmente importe ou gere mais interesse, essas redes criam centenas de postagens, enviam milhares de mensagens, clamam por likes ou dislikes, e começam a ser ecoadas por pessoas de verdade. As vezes, elas o fazem sob a impressão de que foram outras pessoas do mesmo círculo que elas que geraram as mensagens. Porventura, não se importam se foram pessoas ou não, apenas que aquele conteúdo faz sentido ou traz alguma sensação emocional de perigo, alarme, ou confirmação de viés.</p><figure><img alt="Meme do Drake: cara ruim para &quot;informação&quot;, cara boa para &quot;não sei se é verdade, mas é exatamente o que eu penso&quot;" src="https://cdn-images-1.medium.com/max/1024/1*4N7lag6vWCbM1HkVRxTOPg.jpeg" /><figcaption>Meme com texto adaptado por mim</figcaption></figure><p>De qualquer forma, o efeito é o mesmo. Se o conteúdo foi gerado em primeira mão por interesses especiais, espalhado em segunda mão por robôs ou por pessoas de forma voluntária, e depois ecoado por outros, robôs ou humanos, não importa. São círculos concêntricos ou sobrepostos, em que pessoas controlam autômatos, que influenciam pessoas, que controlam a mensagem em grupos, que são apoiados por outros robôs, que são ecoados por pessoas… Uma rede de turcos, mecânicos ou não, mas todos se comportando como ovelhas em um rebanho. Pessoas ou robôs, são todos <em>turcos em lã</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2274b5fd3c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seu filho é viciado em celular? Mais de 160 pesquisas indicam…]]></title>
            <link>https://rpaskin.medium.com/seu-filho-%C3%A9-viciado-em-celular-mais-de-160-pesquisas-indicam-f9d390c54734?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9d390c54734</guid>
            <category><![CDATA[tecnologia]]></category>
            <category><![CDATA[celular]]></category>
            <category><![CDATA[vício]]></category>
            <category><![CDATA[educação]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Fri, 02 Aug 2019 14:24:00 GMT</pubDate>
            <atom:updated>2019-08-02T14:24:00.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7svu2xuMh9Jjnr5D4Y-aOA.jpeg" /><figcaption>Imagem baseada em foto por Brett Sayles @ Pexels.com</figcaption></figure><p>Em um estudo <a href="https://www.frontiersin.org/articles/10.3389/fpsyt.2016.00175/full">publicado na Revista Frontiers in Psychiatry</a>, os autores Gutiérrez, Fonseca e Rubio revisaram mais de 160 papers sobre vício em uso de aparelhos celulares.</p><p>Apesar de não haver um consenso no que exatamente pode ser considerado vício ou não, os pesquisadores demonstram claramente que o problema é real, e o estudo aponta vários aspectos que são extremamente importantes para nós responsáveis.</p><p>O acesso a celulares é cada vez mais comum e se dá cada vez mais cedo. Muitas vezes crianças de 2 ou 3 anos já tem acesso aos dispositivos de seus pais ou mesmo os próprios tablets. Adolescentes mais ainda, e isso afeta diretamente a possibilidade de abuso e problemas.</p><h3>Nomes novos para problemas novos: FOMO, Zapsiedade e mais</h3><p>Novas patologias estão sendo batizadas por conta da necessidade de falar sobre os problemas que estamos percebendo. Alguns deles são:</p><p><strong><em>FOMO</em></strong> (“Fear Of Missing Out”) é o medo literal de estar desconectado da Internet e dos acontecimentos que “demandam” estar por dentro.</p><p><strong><em>Toquesieade</em></strong> (“Ringxiety”) é aquela sensação falsa de ter recebido uma mensagem ou do telefone tocando.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*ZvhXhcaAUqjRVrX918YhfA.png" /></figure><p><strong><em>Textiedade </em></strong>(“Textiety”), ou no Brasil provavelmente poderíamos chamar de <strong><em>Zapsiedade</em></strong> é a angústia de receber, responder e ter a resposta imediatamente à mensagens.</p><p><em>Você acha que algum comportamento merece um novo nome? Deixe seu comentário!</em></p><p>O abuso de celulares chega até a ser análogo à patologias conhecidas de adicção à substâncias e jogos de azar, como, por exemplo:</p><ul><li>Colocar-se em risco — quantas vezes já vimos adolescentes usando celular enquanto andam de bicicleta, na rua, entre os carros?</li><li>Problemas de relacionamento e conflito social ou familiar — por exemplo brigas por desentedimentos por postagens em grupos de amigos ou família?</li><li>Falta de controle — não conseguir ficar sem usar o celular em situações sabidamente inapropriadas como reuniões de família, cinema, etc.</li><li>Uso excessivo — chegando a ultrapassar as franquias de uso de dados, por exemplo.</li><li>Síndrome de abstinência — ansiedade e irritabilidade no caso de ficar sem acesso.</li></ul><p>Os problemas maiores se relacionam em especial questões de extroversão, neurose, auto-estima, impulsividade, auto-identidade e auto-imagem, que são extrememente relevantes na adolescência.</p><p>Questões de distúrbios de sono, ansiedade, stress e depressão relacionadas ao uso de celular e internet são comuns.</p><p>Existe uma correlação entre o uso problemático de celulares e abuso de substâncias como fumo e bebida.</p><h3>O maior abuso acontece entre adolescentes, em especial meninas</h3><p>Praticamente todos estudos indicam que meninas tem maiores problemas com dependência e abuso de celulares.</p><p>Meninas tendem em especial a passar mais tempo usando aplicativos relacionados a contato com pessoas e comunicação, como redes sociais.</p><h3>Impulsividade</h3><p>Jovens impulsivos são mais suscetíveis a abusar de celulares. Algumas características destes são: impulsividade forte, falta de autocontrole, sensação de estados afetivos negativos, falta de premeditação, ficar ruminando pensamentos negativos, tendencia a procurar sensações fortes como perigo e aventura, ter alta sensibilidade ao tédio e preferir novas experiências</p><p>Se o jovem apresenta fortemente algumas dessas tendências, deve-se observar de perto os sinais de abuso de celulares.</p><h3>Autoestima</h3><p>Na maior parte dos estudos, se correlaciona problemas de uso de celular com conceitos ligados à autoestima, auto-controle, auto-vigilância e dependência do ambiente.</p><p>Em especial, foi encontrada correlação entre vício em uso de celular com sentimentos de solidão e carência de aprovação social.</p><p>Muitas vezes o problema se reflete na quantidade <em>excessiva </em>de mensagens de texto.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*Dh2UlPGbCfG5_KENEme8hA.jpeg" /></figure><h3>Problemas de Sono</h3><p>Adolescentes, em especial, tendem a ter problemas de sono por mau-uso de celulares. Em particular é um problema para meninas. Foi observada uma correlação entre o número de chamadas e mensagens e as dificuldades de sono.</p><p>A manutenção de um estado de alerta tende a interferir com o sono, em especial uso excessivo do Facebook.</p><h3>Uso de fumo, bebida e drogas</h3><p>O quadro de abuso de substâncias se relaciona ao abuso de celulares. Há indicações que padrões neurobiológicos em comum indicam sintomas de uso excessivo de internet e depressão.</p><p>Foi achada uma correlação significativa entre uso abusivo de celular, problemas na escola, depressão, fumo e uso de drogas, principalmente entre meninos.</p><h3>A diferença entre abuso de Internet e de celulares</h3><p>Interessanteme é que uso abusivo de Internet e de celulares não correspondem aos mesmos quadros de problemas. Enquanto uso excessivo de Internet muitas vezes se relaciona a problemas de depressão, o uso abusivo de celulares, em especial mensagens de texto, se relaciona a problemas de ansiedade.</p><h3>Mais Internet, mais problemas</h3><p>O aumento de franquias de uso e disponibilidade de wifi em escolas, cafés e restaurantes pode parecer uma ajuda mas pode também trazer muitos problemas. Quando responsáveis passam a monitorar menos o uso, abre-se uma avenida para o abuso. É dever dos pais fazer esse controle. Nesse caso, menos pode ser mais.</p><h3>O que nós, responsáveis, podemos fazer?</h3><p>Aqui vão algumas dicas práticas:</p><ul><li><strong>REGRAS</strong>: O controle deve ser seu, e não da criança ou adolescente: coloque as regras de forma clara e não delegue o controle. <em>Você</em> deve determinar a hora de desligar, e controlar o acesso.</li><li><strong>HORÁRIOS APROPRIADOS PARA USO</strong>: A criança ou adolescente deve entender quando é apropriado o uso ou não. Deixe claro, por exemplo, que você, responsável, não tem a expectativa de contato durante o horário escolar. Afinal, para emergências, a escola tem sempre uma maneira alternativa de contato.</li><li><strong>NÃO DÊ CELULAR PARA CRIANÇAS</strong>: Os maiores índices de problemas acontecem quando o primeiro celular é obtido antes dos 13 anos. A criança realmente precisa ter o próprio aparelho? Considere mais a saúde mental dela do que alguma pressão social!</li><li><strong>MONITORAMENTO</strong>: Um excessivo número de mensagens de texto pode indicar um problema sério. Crie maneiras para saber se o jovem está usando excessivamente o celular.</li><li><strong>USO NOTURNO</strong>: Monitore o sono, o uso durante a noite e se o jovem parece sempre muito cansado. Se necessário, não permita que o jovem tenha o celular durante a noite. Um pequeno e barato relógio com despertador pode ser um ótimo investimento no futuro do seu filho!</li><li><strong>DROGAS</strong>: O uso abusivo de celular e Internet pode sinalizar o abuso de fumo, bebida ou drogas. Fique atento!</li><li><strong>ANSIEDADE</strong>: Repare nos sinais de ansiedade ao ficar desconectado. Isso pode ser indicação de problemas presentes ou vindouros.</li></ul><p>O que você acha? Seu filho pode ter outros problemas não abordados? Você já criou outras estratégias para lidar com os problemas? Deixe um comentário para pesquisarmos o assunto.</p><p>um abraço,</p><p><em>— Prof. Ronnie</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9d390c54734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Colocando um Servidor no Ar em 15 Minutos]]></title>
            <link>https://rpaskin.medium.com/colocando-um-servidor-no-ar-em-15-minutos-a92dd84ca592?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/a92dd84ca592</guid>
            <category><![CDATA[servidor]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programação]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Wed, 10 Jul 2019 17:01:24 GMT</pubDate>
            <atom:updated>2019-07-12T13:08:41.432Z</atom:updated>
            <content:encoded><![CDATA[<h3>Colocando um servidor no ar em 15 minutos</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*404Mc68wUIw0CPIVNOVdhQ.jpeg" /></figure><p><em>A long, long time ago, in a galaxy not far away</em>, demorava muito tempo para ter um servidor na Internet. Precisávamos de uma conexão dedicada, com um computador ligado 24 horas por dia, e muitas vezes nossa única conexão era via linha discada. Além disso, a configuração era complicada e requeria bastante conhecimento sobre como configurar um servidor.</p><p>A coisa mudou bastante. O conceito de PaaS — platform as a service — foi uma das coisas que surgiram para facilitar a vida do desenvolvedor. Ele abstrai a configuração do servidor de uma forma extremamente simples.</p><p>Para exemplificar, vamos usar o PaaS do <a href="https://www.heroku.com/">Heroku</a>, utilizando um servidor simples com Python. (Outras linguagens também são suportadas)</p><p>Em primeiro lugar, precisamos <a href="https://signup.heroku.com/">criar uma conta no Heroku</a>. Você pode ter um servidor gratuito, a limitação principal é a capacidade e disponibilidade (o servidor irá “hibernar” enquanto não está sendo usado e demora mais-ou-menos um minuto no primeiro acesso para “acordar”).</p><p>O próximo passo é instalar o <a href="https://devcenter.heroku.com/articles/heroku-cli">Heroku CLI</a> (command line interface). Se estiver usando MacOS, por exemplo, use o <a href="https://brew.sh/">homebrew</a> via Terminal (atenção, não digite o &#39;$&#39;, apenas os comandos):</p><pre>$ brew tap heroku/brew &amp;&amp; brew install heroku</pre><p>O próximo passo é logar no Heroku.</p><pre>$ heroku login<br>heroku: Press any key to open up the browser to login or q to exit<br> ›   Warning: If browser does not open, visit<br> ›   https://cli-auth.heroku.com/auth/browser/***<br>heroku: Waiting for login...<br>Logging in... done<br>Logged in as me@example.com</pre><p>Ele irá usar o navegador para autenticar sua conta. Se preferir, use “heroku login -i” e entre o usuário e senha.</p><p>O próximo passo é criar um servidor. Vamos usar o Python 3 (estou assumindo que ele já está instalado, senão instale via homebrew ou apt-get, por exemplo). O Heroku tem um <a href="https://github.com/heroku/python-getting-started">repositório de demonstração</a> já disponibilizado pelo Heroku com Django, mas vamos usar algo um pouco mais simples, o <a href="http://flask.pocoo.org/">Flask</a>, um micro-framework web para Python.</p><p>No terminal, crie uma pasta chamada meuservidor (ou qualquer outro nome, mas sugiro evitar espaços e letras maiúsculas).</p><p>Para evitar dores de cabeça, faz sentido <a href="https://virtualenv.pypa.io/en/stable/">instalar um ambiente virtual</a> e usá-lo de forma que suas bibliotecas e versões não atrapalhem outros projetos. Rapidamente, crie e ative:</p><pre>$ python3 -m venv env<br>$ source env/bin/activate<br>(env) $</pre><p>Você irá ver o <em>prompt</em> mudar, indicando que o ambiente (env) está ativado. Caso queira desativá-lo, basta usar o comando <em>deactivate</em>. O que vc instalar agora irá apenas para esse projeto, e não para todo o sistema, e o python usará a versão 3 pois foi a que você usou para criar o ambiente. Vamos instalar o flask:</p><pre>(env) $ pip install Flask</pre><pre>Collecting flask</pre><pre>Downloading https://files.pythonhosted.org/packages/9b/93/628509b8d5dc749656a9641f4caf13540e2cdec85276964ff8f43bbb1d3b/Flask-1.1.1-py2.py3-none-any.whl (94kB)</pre><pre>100% |████████████████████████████████| 102kB 3.8MB/s</pre><pre>[...]</pre><p>Nosso código pode começar extremamente simples e um novo arquivo <em>app.py</em> coloque o abaixo. Você pode usar qualquer editor de texto, mas salve na pasta correta:</p><pre>#!env/bin/python<br>from flask import Flask, render_template, request</pre><pre>app = Flask(__name__)</pre><pre><a href="http://twitter.com/app">@app</a>.route(&#39;/&#39;)<br>def index():<br>    return &quot;Meu servidor rodando&quot;</pre><pre>if __name__ == &#39;__main__&#39;:<br>    app.run(debug=True)</pre><p>E rodar o servidor com python app.py</p><pre>$ python app.py<br>* Serving Flask app &quot;app&quot; (lazy loading)<br>* Environment: production<br>WARNING: This is a development server. Do not use it in a production deployment.<br>Use a production WSGI server instead.<br>* Debug mode: on<br>* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)<br>* Restarting with stat<br>* Debugger is active!<br>* Debugger PIN: 166-330-501</pre><p>Seu navegador já pode abrir o servidor… não muito emocionante, mas o suficiente por agora:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*SAW4jUgLJYBYHFaWXg2MVw.png" /></figure><p>Repare na mensagem sobre WSGI. <a href="https://www.python.org/dev/peps/pep-3333/">Web Server Gateway Interface</a> é um padrão para rodar servidores em vários frameworks. Temos que configurar isso, para nosso servidor rodar no Heroku. Vamos usar o <a href="https://gunicorn.org/">gunicorn</a> que é um WSGI compatível com Flask e outros frameworks. Pare o servidor com CTRL-C e digite:</p><pre>(env) $ pip install gunicorn</pre><p>Agora, também precisamos definir para o WSGI quais bibliotecas estamos usando (Flask e gunicorn). Crie um arquivo <em>requirements.txt</em> com isso.</p><pre>Flask<br>gunicorn</pre><p>Também temos que dizer qual a versão do Python, verifique e coloque em um arquivo <em>runtime.txt</em>, como abaixo:</p><pre>(env) $ python --version<br>Python 3.6.8</pre><pre>(env) $ cat &gt; runtime.txt<br>python-3.6.8</pre><p>(CTRL-D para sair do cat)</p><p>Agora, precisamos de um arquivo Procfile que define como rodar o servidor usando o gunicorn. Ele terá:</p><pre>web: gunicorn app:app --log-file=-</pre><p>Por fim, o Heroku exige que você envie um repositório git. Então vamos criar um arquivo chamado <em>.gitignore</em> primeiro, que serve para não adicionar arquivos desnecessários dentro do repositório. O nome do arquivo tem que ser exatamente esse, começando com . mesmo! (Arquivos começando com . são arquivos escondidos e sistemas tipo Linux.) Pode ser esse abaixo.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a1c61f47a2dd7831e5bf0ec0fddf1da/href">https://medium.com/media/8a1c61f47a2dd7831e5bf0ec0fddf1da/href</a></iframe><p>E vamos então criar o repositório, e adicionar todos arquivos (exceto os ignorados acima).</p><pre>(env) $ git init<br>(env) $ git add .<br>(env) $ git commit -m&quot;Commit inicial&quot;</pre><p>Podemos testar o que o Heroku faria para rodar:</p><pre>(env) $ heroku local web<br>4:37:13 PM web.1 |  [2019-07-10 16:37:13 +0000] [2944] [INFO] Starting gunicorn 19.9.0</pre><pre>4:37:14 PM web.1 |  [2019-07-10 16:37:13 +0000] [2944] [INFO] Listening at: http://0.0.0.0:5000 (2944)</pre><pre>4:37:14 PM web.1 |  [2019-07-10 16:37:13 +0000] [2944] [INFO] Using worker: sync</pre><pre>4:37:14 PM web.1 |  [2019-07-10 16:37:13 +0000] [2947] [INFO] Booting worker with pid: 2947</pre><p>Podemos novamente acessar o servidor na porta 5000 (por exemplo <a href="http://localhost:5000/">http://localhost:5000/</a>)</p><p>Quase lá! Vamos criar uma nova aplicação no Heroku.</p><pre>(env) $ heroku create<br>Creating app... done, ⬢ pure-fortress-11583</pre><pre>https://pure-fortress-11583.herokuapp.com/ | https://git.heroku.com/pure-fortress-11583.git</pre><p>Repare que ele criou uma uma URL aleatória, estilo Haiku (fortaleza pura), e uma url para o git, que já fica configurada:</p><pre>(env) $ git remote -v</pre><pre>heroku  https://git.heroku.com/pure-fortress-11583.git (fetch)<br>heroku  https://git.heroku.com/pure-fortress-11583.git (push)</pre><p>A URL ainda não tem nada:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*xsg4pYdu3yyyMwBlNwYLcw.png" /></figure><p>Mas como o repositório remoto já está configurado, agora que é a beleza da coisa. Basta um git push para o repositório chamado <em>heroku</em>, do branch <em>master</em>.</p><pre>(env) $ git push heroku master</pre><p>Com tudo que fizemos acima, ele automaticamente irá detectar que é um servidor Python, instalar as dependências que colocamos em <em>requirements.txt </em>no python especificado em <em>runtime.txt</em>, e rodar na URL definida. Recarregando:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*UhH-tZV6PDkgUokPugtaMA.png" /></figure><p>Obviamente, isso é o mínimo do mínimo. Poderíamos estar usando um framework mais completo <a href="https://github.com/heroku/python-getting-started">com Django</a> por exemplo, ter um conteúdo melhor na página, etc. Mas temos aqui uma base para simplicidade.</p><p>Faça mudanças localmente, experimente com o <em>heroku local web</em>, adicione as mudanças ao git e para vê-las em produção basta fazer um novo <em>git push heroku master</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*1lPhQS8xVMwoj7hHwUdOgQ.gif" /></figure><p>Parabéns! Seu servidor agora está disponível na Internet para qualquer um acessar!</p><p>Um abraço!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a92dd84ca592" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Must Know Steps to Automate a Web Task on Windows]]></title>
            <link>https://rpaskin.medium.com/must-know-steps-to-automate-a-web-task-on-windows-aaeaf3c34339?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/aaeaf3c34339</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[crawling]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[windows]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Thu, 13 Jun 2019 16:04:08 GMT</pubDate>
            <atom:updated>2019-06-19T14:30:57.728Z</atom:updated>
            <content:encoded><![CDATA[<h3>4 Steps You Must Know to Automate a Web Task on Windows</h3><p>Have you ever had to do something repetitive on a web system? Quite possibly, I imagine. Have you ever had to do it based on data in a file? That’s really not uncommon, and even if you have not, we might learn a thing or two, so let’s do it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*pGr9npAp2XniXOyNd7eR4w.gif" /></figure><p>First things first, we’ll be using Windows (last time I did this on a Mac, which I think makes it easier since a Mac is unix-based). Boy, I’m preparing for some frustration here… but oh well 🤷‍♂️.</p><p>Not wanting to reinvent the wheel, I looked at some plug-ins like <a href="https://github.com/SeleniumHQ/selenium-ide">Selenium IDE </a>and <a href="https://imacros.net/">iMacros</a> but after some experimentation it didn’t seem they’d do what I wanted, at least not for free 💰. So I decided to use Python and Selenium instead.</p><p>Usually I run things under the Windows Linux Subsystem, which is great because it’s just like Ubuntu, for example. But I have a feeling it’s not going to integrate well with opening a Browser and in this case, I need this to run on someone else’s computer as well. So no Nutella installation, let’s go full hardcore Windows native PC master race here 乁( ⁰͡ Ĺ̯ ⁰͡ ) ㄏ.</p><p>I donwloaded the <a href="https://www.python.org/downloads/">Official Python 3.7.3 release package</a> and installed it, so far so good.</p><p>Then to try and make things easier on me, I thought of using pyenv (a fork of the great rbenv Ruby environment tool) to manage multiple Python versions as we can do under Linux/ Mac OS. Let’s try <a href="https://github.com/pyenv/pyenv">pyenv</a>… And of course! Not so fast, cowboy 🤠! On the README:</p><pre>If you&#39;re on Windows, consider using @kirankotari&#39;s <a href="https://github.com/pyenv-win/pyenv-win">pyenv-win</a> fork. (pyenv does not work on windows outside the Windows Subsystem for Linux)</pre><p>So, let’s head over to <a href="https://github.com/pyenv-win/pyenv-win">pyenv-win</a>, which turns out to be a fork or rbenv-win. As per the readme, install via pip, add to PATH via editing environment variables… and <em>nada</em>. Should have worked in a new (power) shell but no cigar. ಠ▃ಠ Let’s try with git-bash as per the alternative instructions… checking the path shows my early try did add it, so that part’s taken care of.</p><pre>$ echo $PATH</pre><pre>/c/Users/rpaskin/bin:/mingw64/bin[...]/c/Users/rpaskin/.pyenv/pyenv-win/bin:/c/Users/rpaskin/.pyenv/pyenv-win/shims:/usr/bin/vendor_perl:/usr/bin/core_perl</pre><p>Then use pip again to try and install:</p><pre>pip install pyenv-win --target $HOME/.pyenv</pre><p>And to check it:</p><pre>$ pyenv --version<br>pyenv 1.2.2</pre><pre>$ python --version<br>Python 3.7.3</pre><p>So, at least under git-bash, it seems we’re good to go on Python and pyenv. However, I didn’t really get how to actually use pyenv… Ugh. Skipping that for now.</p><p>Anyhow, ⊂◉‿◉つ Yay! Let’s finish shaving that Yak! <strong>3:-O</strong></p><p>I know I’ll be needing a <a href="https://www.seleniumhq.org/projects/webdriver/"><strong>Selenium Webdriver</strong></a> installed. Let’s try and have Chrome set up by using <a href="http://chromedriver.chromium.org/downloads">Chrome WebDriver</a>. I’m using Chrome 75.0.3770.80, so I grabbed the driver for that, unzipped it and we need to put it somewhere in the path. I opted to C:\Windows for simplicity.</p><p>Let’s also install Selenium for Python, with pip.</p><pre>pip install selenium</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*Fo3cYIVRvBCPGG9Rbl8r4g.gif" /><figcaption>Yak Shaved!</figcaption></figure><p>That went fine, so we should be good to go!</p><p>All right, let’s start, finally. I’ll start by copying <a href="https://selenium-python.readthedocs.io/getting-started.html">the example from the documentation</a> and just set it to use Chrome instead of Firefox.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca2f79820f0b4081568749a9c23f1831/href">https://medium.com/media/ca2f79820f0b4081568749a9c23f1831/href</a></iframe><p>To run I used python crawl.py in git-bash. The firewall asked me for permission to access things, something similar to the image below. That’s fine, just hit Allow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*00d43I8zoxxZR8hFRYQcfg.png" /></figure><p>So it looks like it’s working but when I run it, it flashes too quickly and closes the browsers. See, it’s not always a huge advantage to have a fast computer! Let’s import the time library up top, add a 10-second delay for us puny humans 👶 after line 10 and try again.</p><pre>from time import sleep<br>...<br>sleep(10)</pre><p>Now I can see it opened the Chrome browser, went to <a href="http://www.python.org,/">www.python.org,</a> entered pycon in the search box, showed results and waits 10 seconds before closing the browser. All right!</p><p>Now, the next part is, I want to input some data from a file and use it. Let’s say we want to have a file with an URL, the field identifier to input data in, and the string to search for. I created a CSV file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ce8c21c9712a4cc49aae802844c6a0f/href">https://medium.com/media/3ce8c21c9712a4cc49aae802844c6a0f/href</a></iframe><p>I’m going to iterate through each line and do the operation on each one, using the <a href="https://docs.python.org/3/library/csv.html">csv library</a>. Let’s look at the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/14064b3f6ed1862d8fca8f81e5e4e32e/href">https://medium.com/media/14064b3f6ed1862d8fca8f81e5e4e32e/href</a></iframe><p>Some notes: I added the csv library, and if you look at lines 10, 11 and 13 you’ll see lstrip(). That’s because I’m an idiot and added extra spaces on the csv file I created. Since that was already on the gist, to prevent problems I’m just dealing with it™️.</p><p>When I run that code, it opens each site in column 0 of the CSV file, finds each element with the name in column 1, and searches for each text in column 2, then waits 10 seconds before doing the next site. Voilà!</p><p>To recap we:</p><ul><li>(1) Installed Python, pyenv and Selenium on Windows</li><li>(2) Opened a site and interacted with it through Chrome and a Python script</li><li>(3) Created a CSV file to iterate through</li><li>(4) Tweaked the script to repeat the action for each line in the CSV file</li></ul><p>( ━☞´◔‿ゝ◔`)━☞ That wasn’t so hard, was it?!</p><p>Cheers,</p><p>(づ￣ ³￣)づ,</p><p>— Ronnie</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aaeaf3c34339" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Whoa! Process a local file, create an Etherum account and sign it on Android With Opera]]></title>
            <link>https://rpaskin.medium.com/whoa-process-a-local-file-create-an-etherum-account-and-sign-it-on-android-with-opera-10dc90af94a7?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/10dc90af94a7</guid>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 19:33:22 GMT</pubDate>
            <atom:updated>2019-06-06T19:55:34.835Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been experimenting with using web3js/ Ethereum on Android, by using Opera for Android. In case you didn’t know, it includes that functionality natively. Check out <a href="https://medium.com/@rpaskin/playing-with-ethereum-in-opera-for-android-d1fb1b0ba7bb">my posts on Medium</a> about it.</p><p>Here’s want I want to do now: I want to be able to get a file on Android, calculate its hash, and sign it using an Ethereum account’s private key. Let’s get to it!</p><p>You can check hashing for yourself with <a href="https://emn178.github.io/online-tools/sha256_checksum.html">this online hashing tool</a>, but we want to replicate this locally on Opera on Android. I’ll start by creating a simple HTML file to receive a file. To make things easier, I’m already doing some bootstrapping and added some libraries we’ll use: <a href="https://web3js.readthedocs.io/en/1.0/">web3js </a>for Ethereum, <a href="https://github.com/emn178/js-sha3">sha3</a> for hashing and <a href="https://zeptojs.com/">Zepto </a>for light jQuery-like javascript goodies.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/73c22b79bd7440d9ebaff050a2d26ee6/href">https://medium.com/media/73c22b79bd7440d9ebaff050a2d26ee6/href</a></iframe><p>I then open this on Opera on Android, through the debug feature on Opera Desktop. Again, see <a href="https://medium.com/@rpaskin/playing-with-ethereum-in-opera-for-android-d1fb1b0ba7bb">my previous articles</a> for details on that. On Android we can’t drag and drop a file onto the file button, but we can click on the button. For some reason, Opera asks me to allow audio recording first, not sure why 🤷‍♂️, but let’s skip that. We can then choose “Files” and go to a File Manager 📂. There, we can select a file. As it is now, it will just pop up an alert (see line 15 above) and not allow submitting the form (see line 14).</p><p>All right, let’s process the file now. We need to receive the file, first. So let’s replace alert on line 15 with a function call, and create the function that uses a FileReader object to grab the contents of the file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2b60310516e63e9d049dfe531cb67a3/href">https://medium.com/media/f2b60310516e63e9d049dfe531cb67a3/href</a></iframe><p>If you select a file, the console will show the resulting content as an ArrayBuffer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*amwUThp5H7xkLmA9tgJN_g.png" /><figcaption>Yay! Looking good!</figcaption></figure><p>We’re really close now! Let’s just hash that ArrayBuffer now using the sha3 library we preloaded. For examle to use the standard Ethereum’s <a href="https://keccak.team/keccak.html">keccak256 </a>(pronounced more-or-less like “ key-tshah-k”) it’s as simple as</p><pre>console.log(28, keccak256(data));</pre><p>I’m going to use this <a href="http://www.africau.edu/images/default/sample.pdf">sample pdf</a> file. We can use the <a href="http://emn178.github.io/online-tools/keccak_256_checksum.html">online tool</a>, and we get be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4 as a resulting keccak256 hash. Let’s see if it matches:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*XGMWyuMOFYS6RBCHvu5x7Q.png" /></figure><p>Well, look at that. The same result as the online tool for the same file! (Notice it’s most likely good enough to look at the first few bytes to compare.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*gRqZsWeZCKStwMIanaMabg.gif" /><figcaption>Oh Oh! Ohhhh yeah…</figcaption></figure><p>This is pretty cool 😎. Now let’s see if we can sign this hash with Opera’s ethereum account and output the resulting r, s, v signature.</p><p>First, we fire something on document ready to save my Opera Wallet Ethereum account.</p><pre>$( document ).ready(function() {<br>   web3.eth.getAccounts().then((accounts) =&gt; { myAccount = accounts[0] });<br>  });</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLgZVzEP2XBytH1Ae49KYQ.png" /><figcaption>Popup to allow wallet access the first time you do it</figcaption></figure><p>We can then use that to sign, by using <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-personal.html#sign">web3’s personal.sign method</a>. Let’s tweak the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*IsBJ631e8LbXHF_6KmBTNw.gif" /><figcaption>Quick note: my USB connection to the device is not too stable, and I don’t know if it’s the cable or a software issue. Don’t get worked up over it, just reconnect and kill/ restart adb.</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/730383238a430901489d193273276915/href">https://medium.com/media/730383238a430901489d193273276915/href</a></iframe><p>So now if we click through to that page, and select a file, we get a request to sign the hash of the file. Noice!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98dvlGI8h4HMTIjsu2sZVw.png" /></figure><p>And we see the signed r, s, v package is filled out in the input:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gj5zuJq6R5ZgLTqfK7kDnA.png" /><figcaption>Mirrored Opera Mobile on Opera Desktop, with console</figcaption></figure><p>As you see above, we got the signed package 0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f5474779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da9478551c. This should represent r, s and v for the content be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4, the hashed message, signed by account with public key 0xfE89f15d34c684fFbfeD74eC81A2842159e2eD3b.</p><p>I wonder if we can test that… We can look at what I <a href="https://medium.com/@rpaskin/wow-signing-a-message-on-opera-on-android-with-a-private-key-cff9bca84c06">used last time</a>. To use that, we need to split r, s and v. v is the last byte, and it’s always either 27 or 28 (hex 1b or 1c). The others are 32 bytes each. So, we get:</p><pre>r: 0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f547<br>s: 0x4779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da947855<br>v: 0x1c</pre><p>And then on a console’s browser, we can try and do:</p><pre>web3.eth.accounts.recover({messageHash: &quot;be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;, v: &quot;0x1c&quot;, r: &quot;0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f547&quot;, s: &quot;0x4779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da947855&quot;});</pre><pre>&quot;0x1eFFD1a3f7DB8D21B7233eC22f685bc97A22f390&quot;</pre><p>📯Wahh, wahh, wahh… it didn’t work. Let’s try again:</p><pre>web3.eth.accounts.recover({messageHash: &quot;0xbe5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;, v: &quot;0x1c&quot;, r: &quot;0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f547&quot;, s: &quot;0x4779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da947855&quot;});</pre><pre>&quot;0xc4412846c2B8F2E803AACe488d49CdF8E9Bd50D9&quot;</pre><p>Nope. Argh, what’s happening here?</p><p>The sign method takes a string, but what it signs is actually another hash of that string. For example, if we try and sign something like so (straight from the <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#sign">documentation</a>):</p><pre>web3.eth.accounts.sign(&#39;Some data&#39;, &#39;0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318&#39;);</pre><pre>{message: &quot;Some data&quot;, messageHash: &quot;0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655&quot;, v: &quot;0x1c&quot;, r: &quot;0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd&quot;, s: &quot;0x6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a029&quot;, …}<br>message: &quot;Some data&quot;<br>messageHash: &quot;0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655&quot;<br>r: &quot;0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd&quot;<br>s: &quot;0x6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a029&quot;<br>signature: &quot;0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a0291c&quot;<br>v: &quot;0x1c&quot;<br>__proto__: Object</pre><p>See? It actually shows us the messageHash it actually signed. It did not sign the actual string, so recovering that won’t work. We need to get the hash from the string, for example, like so:</p><pre>web3.eth.accounts.hashMessage(&quot;Some data&quot;);</pre><pre>&quot;0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655&quot;</pre><p>(BTW, if you want to know what’s happening here, I explained it in my other article. 😎)</p><p>So, let’s try and recover from the above hashed message:</p><pre>web3.eth.accounts.recover({messageHash: &quot;0x1da44b586eb0729ff70a73c326926f6ed5a25f5b056e7f47fbc6e58d86871655&quot;, v: &quot;0x1c&quot;, r: &quot;0xb91467e570a6466aa9e9876cbcd013baba02900b8979d43fe208a4a4f339f5fd&quot;, s: &quot;0x6007e74cd82e037b800186422fc2da167c747ef045e5d18a5f5d4300f8e1a029&quot;});</pre><pre>&quot;0x2c7536E3605D9C16a7a3D7b1898e529396a65c23&quot;</pre><p>And we can check that the result was the public key derived from the private key we used.</p><pre>web3.eth.accounts.privateKeyToAccount(&#39;0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318&#39;);</pre><pre>{address: &quot;0x2c7536E3605D9C16a7a3D7b1898e529396a65c23&quot;, privateKey: &quot;0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318&quot;, signTransaction: ƒ, sign: ƒ, encrypt: ƒ}<br>address: &quot;0x2c7536E3605D9C16a7a3D7b1898e529396a65c23&quot;<br>encrypt: ƒ (e,t)<br>privateKey: &quot;0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318&quot;</pre><p>So, that matched. Ok! Back to the grind. We probably forgot about that by now… We’re trying to recover my public key <em>0xfE89f15d34c684fFbfeD74eC81A2842159e2eD3b</em> from the signed hash of <em>be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f</em> with resulting rsv <em>0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f5474779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da9478551c</em>. Try reading all that while chewing peanut butter 🥜. Seriously. Please. Post on YouTube and send me that video! (On second thought, maybe not… apparently there are several versions of peanut butter challenges on YouTube. Do yourself a favor and don’t search for that like I did!)</p><p>To try and understand what’s happening I did this on the Opera Android console, signing a couple of different versions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*A9FwYU1G_5yCNfSNIV19gg.png" /></figure><p>None match my previous 0x9dd signature, hmm... Let’s try and figure it out.</p><p>I’m sending to the sign function (see line 30 in the code above):</p><pre>keccak256(data)</pre><p>This is <em>be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4</em>. Let’s replicate that in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*HjBLD6TxrtKu8Vm5i-FrkA.png" /></figure><p>Weird, how’s that different than what I did above? Ah, ok. I’m an idiot. 🤦‍♂ ️Copy and paste error, missed the last character.</p><p>So, let’s try again. Above, I got the r, s, v:</p><pre>0x9dd04542ce267bab31cf6f20165be05740b0e63eeeaf8f06edb737a70df7f547<br>0x4779f03c3a22f537872dbd9c13db096138145736a9dd2a6dd2be81a8da947855<br>0x1c</pre><p>The message hash is:</p><pre>web3.eth.accounts.hashMessage(&quot;be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;)</pre><pre>0x44bd7c1c428359d3eea3adb5d88f4cfd7410c2869171b73f9f4c7cb0fc5373d8</pre><p>If I recover that, for example on a chrome console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*baYfaefDPWVyaSfIOn-RKw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/1*iISNIGfWIt6OTzFOKNxDGg.gif" /></figure><p>Which is exactly my public key! Whew!</p><p>Let’s try that on Solidity, using a quick Smart Contract.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/45c36c5e22dd0ac43f5504c107a56a67/href">https://medium.com/media/45c36c5e22dd0ac43f5504c107a56a67/href</a></iframe><p>To run that I used Remix real quick (look at that brand new Remix interface, huh, slick!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NgltQ-ao9F8wtQRk0VI_w.png" /></figure><p>An voilà! We recovered the correct signer on JavaScript and on Solidity. Case closed, your honor ️👩‍⚖️! I hereby do declare that we:</p><ul><li>Grabbed a file with a file input on Opera on Android.</li><li>Hashed that mofo.</li><li>Signed the darn thing.</li><li>Extracted the r, s and v values from that signature.</li><li>G̶o̶t̶ ̶c̶o̶n̶f̶u̶s̶e̶d̶ ̶w̶h̶y̶ ̶r̶e̶c̶o̶v̶e̶r̶e̶d̶ ̶s̶i̶g̶n̶e̶r̶ ̶d̶i̶d̶n̶’̶t̶ ̶m̶a̶t̶c̶h̶,̶ ̶t̶h̶e̶n̶ ̶u̶n̶c̶o̶n̶f̶u̶s̶e̶d̶.̶</li><li>Checked that the signer matched my Opera Ethereum wallet public key.</li></ul><p>What did you think of this one? It got a little tricky but I think we managed to get through it. Let me know if you have any suggestions or comments.</p><p>Cheers,</p><p>— Ronnie</p><p>P.S. So… I just realized I skipped over creating a new account. So let’s do it as an addendum. 😬</p><p>I’ll do this on Opera on Android through the console. Creating a new account:</p><pre>acct=web3.eth.accounts.create()</pre><pre>{address: &quot;0xb032fFd074fccE347d5cA110D3910Fb63fa7A6d0&quot;, privateKey: &quot;0x22f871222c524b64a31bc137639005e718649646764c0f350d746d37cbd4b9a2&quot;</pre><p>Let’s sign with that account:</p><pre>acct.sign(&quot;be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;)</pre><pre>{message: &quot;be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;, messageHash: &quot;0x44bd7c1c428359d3eea3adb5d88f4cfd7410c2869171b73f9f4c7cb0fc5373d8&quot;, v: &quot;0x1c&quot;, r: &quot;0xd11fbcae629af05c5a67cd1353d11f64ee8b7573156d380bfe898691b387049d&quot;, s: &quot;0x2d256d1c94a2b4e056aeeaa81b86d05c72d15584bf260c1a0aaf7e4177142b13&quot;, …}<br>message: &quot;be5b5152fcd01b6bf53f149bfd1493a49ec5e8ae94cc4c29a81563eea0e347f4&quot;<br>messageHash: &quot;0x44bd7c1c428359d3eea3adb5d88f4cfd7410c2869171b73f9f4c7cb0fc5373d8&quot;<br>r: &quot;0xd11fbcae629af05c5a67cd1353d11f64ee8b7573156d380bfe898691b387049d&quot;<br>s: &quot;0x2d256d1c94a2b4e056aeeaa81b86d05c72d15584bf260c1a0aaf7e4177142b13&quot;<br>signature: &quot;0xd11fbcae629af05c5a67cd1353d11f64ee8b7573156d380bfe898691b387049d2d256d1c94a2b4e056aeeaa81b86d05c72d15584bf260c1a0aaf7e4177142b131c&quot;<br>v: &quot;0x1c&quot;</pre><p>We can see the same messageHash, but different r, s and v values, and we can recover that:</p><pre>web3.eth.accounts.recover({messageHash: &quot;0x44bd7c1c428359d3eea3adb5d88f4cfd7410c2869171b73f9f4c7cb0fc5373d8&quot;, v: &quot;0x1c&quot;, r: &quot;0xd11fbcae629af05c5a67cd1353d11f64ee8b7573156d380bfe898691b387049d&quot;, s: &quot;0x2d256d1c94a2b4e056aeeaa81b86d05c72d15584bf260c1a0aaf7e4177142b13&quot;});</pre><pre>&quot;0xb032fFd074fccE347d5cA110D3910Fb63fa7A6d0&quot;</pre><p>How easy was that now? 🕺</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*ieeh5n_xLwGERhMjnBlg-g.png" /><figcaption>This is the copy from the console</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10dc90af94a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wow! Signing a Message on Opera on Android With a Private Key]]></title>
            <link>https://rpaskin.medium.com/wow-signing-a-message-on-opera-on-android-with-a-private-key-cff9bca84c06?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/cff9bca84c06</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Wed, 05 Jun 2019 22:53:27 GMT</pubDate>
            <atom:updated>2019-06-06T19:43:08.249Z</atom:updated>
            <content:encoded><![CDATA[<p>After figuring out how to <a href="https://medium.com/@rpaskin/playing-with-ethereum-in-opera-for-android-d1fb1b0ba7bb">use Opera on Android with Ethereum</a>, I wanted to know if I can actually sign a message using a private key. Can we do it? What do you think?</p><p>To figure it out, let’s first use our extremely complex ™️ page:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;Test Opera&lt;/title&gt;<br> &lt;script src=&quot;//cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;Working!&lt;/body&gt;<br>&lt;/html&gt;</pre><p>We deploy that to a server, open Opera on Android, connect to it with a USB cable and via adb on a Windows Powershell</p><pre>.\adb.exe forward tcp:9222 localabstract:com.opera.browser<br>.devtools</pre><p>and use the console by going to <a href="/service/chrome:\\inspect"><em>chrome:\\inspect</em></a> on Opera on Windows. Looking good!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LU95GR_MvR7fmqVE9Kj2UQ.png" /></figure><p>As we’ve seen, we can now play with the console on the right-hand and it will run on the Android Browser. Handy. Let’s get to it.</p><p>First, we need to connect to a web3js websocket provider:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*tOvpr9wusiynqpJsujAbxA.png" /></figure><p>We can check if we access the current account, we should already have one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/1*TIrNWFDIBgvD7OZZ9vHhRA.png" /></figure><p>Dope. But can we create a new account? Let’s try:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*w3_NkPe5GD4dyhzEAQbmyQ.png" /></figure><p>Whoa, that was easy 🙌! We have a <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=create">web3js account object</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*LuyQ9ih3gf0403Pn_qiB7A.gif" /><figcaption><em>Never, ever</em>, publish a private key publicly like I just did above! This is a test. No one should will be using this private key unless they don’t know what they’re doing. Or they’re writing this.</figcaption></figure><p>So, at this point, for some reason my adb connection is flaky. Maybe it’s my USB cable, I don’t know. To reset the connection just kill the adb server (<em>.\adb.exe kill-server</em>), disconnect and reconnect the cable, and start it again, it should be ok. Except that you have to restart your debugging session… So my account object is no more.</p><p>We have two options, we can do this the easy way (create another account object) or the hard way (recreate the account since we have the private key). Of course, let’s do things the hard way and learn. Yay for teachers 👨‍🏫!</p><p>First, instead of connection to web3js again, let’s add this to our source code. Man, this is some complicated code (hint: being sarcastic here!).</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;Test Opera&lt;/title&gt;<br> &lt;script src=&quot;//cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br> &lt;script type=&quot;text/javascript&quot;&gt;<br>  const web3 = new Web3(ethereum);<br> &lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br> Working!<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Now we have web3 already initialized, we don’t need to redo this every time the page reloads.</p><p>Ok, let’s recreate the account by using <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=create#privatekeytoaccount">privateKeyToAccount</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*RaGTeP6-lyf5ZReTYglqqg.png" /></figure><p>Yeah, I had to type the private key we had generated before, it wasn’t saved anywhere except that image. Fun facts: The private key is really just a random number (in hexadecimal).</p><p>Let’s check the public key it calculated. It starts with E4F4 and ends with 7af4, which is exactly what we had before! The reason is the public key is derived mathematically from the private key. Neat, huh? Also, we don’t really need to check the whole number, these two beginning bytes and two ending bytes should suffice. The odds of typing a random private key and getting matching 4 bytes are astronomically low! Seriously, if you manage that, drop me a message with the alternate private key and I’ll send you a gift 🎁.</p><p>So, I think that’s pretty darn cool. We used the same private key and got the public key back again. Now we have a new instance of the same account to play with, because math! What else now, but to pause for an ode to our muse: <em>How beautiful art thou, Lady Mathematica, how beautiful art thou! thy eyes are doves’ eyes, besides what is hid within. Thy hair is as flocks of goats</em>… Goats? Ok, this is getting weird. What is it with olden days and goats? Sheesh! Let’s move on.</p><p>Next step is, we want to sign a message. ECDSA (Elliptic Curve Digital Signature Algorithm) signing means to create a signed package proving that you’re the holder of the private key that corresponds to a known public key. We could sign for example an Ethereum transaction sending some ETH to someone, but let’s use our private key to sign an arbitrary string using the <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=create#sign">accounts.sign</a> method. What string to use, I dost wonderst?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*kV1QYmZ_96-uRDtjzXET7Q.png" /></figure><p>So we signed our message, using the <em>sign</em> method from our <em>acct</em> object. We could sign it with the private key directly too, by using the <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=create#sign">eth.accounts.sign</a> method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*r0MSMs4TQJt5zeU6OPriWg.png" /></figure><p>The signed package here is divided into three components: r, s and v, seen above. This is fairly complex, but all you really need to know is that by knowing the r, s, v values and the original message string, someone else could calculate who was it that signed this message, by using the <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=create#recover&quot;"><em>recover</em></a><em> m</em>ethod, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*bp0zf3iI89nrVmg3DJISfg.png" /></figure><p>So we have our original account 0xE4F4… Oh… F**k. Not really, what’s happening here?</p><p>Notice the recover method uses the messageHash, not the original message. The message hash is a keccak256 (SHA3, but not really SHA3 as it was implemented during a transition phase, it seems… anyhow) hash of the message. If you notice above, it said that in the output from the sign method, there was a messageHash property. Let’s do it the hard way™️ and reconstruct that message. We’ll try and use the <a href="https://web3js.readthedocs.io/en/1.0/web3-utils.html?highlight=keccak256#soliditysha3">soliditySha3</a> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*h7ikkTvAHjJQw1N8B7YSxg.png" /></figure><p>Notice that doesn’t match the output of the sign method above (starts with 0xdea7a). WTF is happening here? Unfortunately, that’s not trivial. To make it easier on us, we can use a handy method to create this hash for us, <a href="https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html?highlight=hashmessage#hashmessage">hashMessage</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*wnPqJKcoXJmEYwKdN1Vaeg.png" /></figure><p>Oooh, it matches what we wanted! But why is that any different from the <em>SHA3</em> we tried to use before…? Cool thing about open source projects like web3js is… they’re open source! We can actually look at what the code is doing behind the scenes😎. Let’s take a <a href="https://github.com/ethereum/web3.js/blob/1.0/packages/web3-eth-accounts/src/Accounts.js">looksee </a>🕶 and see what the hashMessage method does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*Atti7Dq6GS09-OoI4BX8ZQ.png" /></figure><p>What the heck is that? Here’s the thing. Remember how we said you could sign an Ethereum transaction sending some ETH to someone? Some nasty hacker could trick a user into unwittingly signing that sort of thing 😱. That would be bad. So when you’re signing an arbitrary message, it tacks on that 25 character (19 hex) prefix “ \u0019Ethereum Signed Message:\n”, followed by the length of the message (in our case 150 characters, go ahead, count it), to the beginning of the string. That way the user can’t sign something he shouldn’t. We can see how this matches:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*Ez26yqBsj2tkvNExAUFPMQ.png" /></figure><p>Let’s finally get back to verifying the signed r, s, v package:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*eSaNjyoMDqumeY1AvNjROA.png" /></figure><p>We got the correct value now. Oh yeah!</p><p>We could even be on a completely different browser, or even programming language, the recovered account should match:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbv4uN-gT3sQUc1JHOILCw.png" /><figcaption>Recovering the signer on Chrome</figcaption></figure><p>I even whipped up a little Solidity contract to test it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwqW0amVMUvvunzEMhfvPA.png" /><figcaption>Solidity Smart Contract to recover a signer, showing the resulting public key on the bottom left (yes, it matches!)</figcaption></figure><p><em>So, to recap</em>: we’ve created a new account with a private key and derived public key. We used that private key to sign our oh-so-arbitrary string. We figured out how it creates the hash of the signed message. We checked that the result shows who signed it across multiple browsers and even programming languages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*R6RH69HofCojl2cHCnlFBQ.gif" /></figure><p>As Shakespeare would put it:</p><blockquote>This above all: to thine own self be true, <br>And it must follow, as the night the day, <br>Thou canst not then be false to any man.</blockquote><p>What did thou thinkest? Ready to sign lots of things? Or still confused? Let me know.</p><p>P.S. Want to do more? Thou hast endless energy, don’t thou? so, go check out how to <a href="https://medium.com/@rpaskin/whoa-process-a-local-file-create-an-etherum-account-and-sign-it-on-android-with-opera-10dc90af94a7">Hash a File and Sign it on Opera for Android</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cff9bca84c06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Playing With Ethereum in Opera for Android]]></title>
            <link>https://medium.com/coinmonks/playing-with-ethereum-in-opera-for-android-d1fb1b0ba7bb?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1fb1b0ba7bb</guid>
            <category><![CDATA[dapps]]></category>
            <category><![CDATA[opera]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Tue, 04 Jun 2019 20:44:05 GMT</pubDate>
            <atom:updated>2020-09-21T15:31:18.357Z</atom:updated>
            <content:encoded><![CDATA[<p>The Opera browser now (as of 6/2019) includes a built-in Ethereum Wallet. To set up a wallet, one needs to sync up the <a href="https://play.google.com/store/apps/details?id=com.opera.browser">android app</a> with the <a href="https://www.opera.com/">desktop app</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*gpoE15msdjN30sWWEprIAg.jpeg" /><figcaption>Show to Code to sync the Ethereum account</figcaption></figure><p>On the desktop app, go to the Crypto Wallet sidebar on the left, click on Reveal the code, then scan it with the app (more details <a href="https://help.opera.com/en/how-to-use-operas-crypto-wallet-on-your-computer/">here</a>).</p><p>The mobile browser will then include the Ethereum Account created within Opera. You can receive and send Ether.</p><p>That’s great, but even better is the ability to then use the Ethereum DApps (Decentralized Applications) like 🧀<a href="https://www.cheezewizards.com/">Cheeze Wizards</a>… or something more useful from the mobile browser.</p><p>The problem is, as with many state of the art distributed ledger/ blockchain applications, documentation is still not great, it takes a little digging… so let’s dig together!</p><p>First, we need to be able to poke around the mobile console so we can understand how <a href="https://web3js.readthedocs.io/en/1.0/">web3js </a>will work there. So I set up a static web page to access on a web server and verified Opera on Android could open it.</p><p>Then, we need to connect the debugging console there. There’s some neat documentation <a href="https://dev.opera.com/articles/remotely-debugging-opera-for-android/">here</a>, but it’s a little outdated. In a nutshell, you need a browser on the desktop to do the debugging (we’ll use Opera), you need to connect an Android device with an USB Cable, and you need to enable USB debugging on the Android Developer Options. However, the opera debug setting as described did not work for me.</p><p>On windows I had to use adb (Android Debug Bridge, usually installed with Android Studio, or can be installed from within the Studio going to Tools &gt; SDK Manager).</p><p>In my case, adb was in my home directory under AppData\Local\Android\sdk\platform-tools. I used a Windows Powershell and ran in the command line:</p><pre>.\adb.exe devices</pre><pre>adb server version (39) doesn&#39;t match this client (41); killing...<br>could not read ok from ADB Server<br>* failed to start daemon<br>adb.exe: failed to check server version: cannot connect to daemon</pre><p>Yikes! After some digging by using Task Manager — with ctrl+shift+esc — I saw I had another adb.exe process running, with a different version. By right-clicking &gt; Properties, I saw where it was spawining from, I had an application running in the background with a different adb version. I uninstalled the app, wasn’t really using it. This allowed me to run adb properly and show devices attached:</p><pre>.\adb.exe devices</pre><pre>List of devices attached<br>0048905859      device</pre><p>Quick adb useful commands you should know:</p><pre>.\adb.exe start-server<br>(starts -- duh -- the adb daemon)</pre><pre>.\adb.exe kill-server<br>(stops the daemon)</pre><p>And to allow debugging use, for Opera:</p><pre>.\adb.exe forward tcp:9222 localabstract:com.opera.browser.devtools</pre><pre>* daemon not running; starting now at tcp:5037<br>* daemon started successfully</pre><p>If you see the messages above, you’re doing great. Give yourself a pat on the back.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*BVMwbSFDTExriV-M2jZXPw.gif" /></figure><p>(Side note: If you ever wanted to debug the Android Chrome, it’s easy too, just use the command below instead)</p><pre>.\adb.exe forward tcp:9222 localabstract:chrome_devtools_r<br>emote</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/1*nYa0nj6GKDOn4-jLaasJBg.png" /></figure><p>(BTW, at some point here it should ask you to allow USB Debugging from your computer. Not sure when, but you have to allow it, obviously.)</p><p>At this point, you’ve forwarded local tcp port 9222 to your Android’s debugging console. Now, the documentation was off again. Going to localhost:9222 works for debugging Chrome, but for me it did not work for Opera.</p><p>Thanks to my colleague <a href="https://medium.com/u/338e934bcc1b">João Gabriel Thiebaut Jardim</a> (a.k.a. <a href="https://www.twitch.tv/xbl_gluteos">XBL_Gluteos on Twitch</a>, check it out), he found out you can type chrome://inspect in Opera, which should show you a cool little screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*ROC0-hAJfdH3QtS0HYbRAQ.png" /><figcaption>Type chrome://inspect to access the connected device</figcaption></figure><p>Aha! Now we’re talking. We can open a new URL, inspect an open tab on Android, all sorts of goodies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Qt3t7eE972iCDuaWrCrw7A.gif" /></figure><p>(📢ATTENTION — UPDATE ⚠: You <em>must</em> use <strong><em>https </em></strong>for your page or things will not work! I’ ve just wasted I’m not even gonna say how long with that!)</p><p>So, finally, we’re done shaving the Yak 🐂! Let’s play with Ethereum on Android!</p><p>Here’s my web page. Warning ⚠, extremely complex!</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>  &lt;title&gt;Test Opera&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  Working!<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>I inspected the web page, and opened the JavaScript console. Wonder if it injects web3js like the <a href="https://metamask.io/">Metamask</a> plugin does. Apparently not… 😖</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_HhiyXHt0MMrC9WZB7d0Jg.png" /><figcaption>Inspected tab with the Console: no Web3</figcaption></figure><p>At some point here, Opera on Android will require you to allow access from that site to your wallet, you need to allow it, of course:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aU6Kmv2rO_c3Mo4tzxN7yQ.png" /></figure><p>All right, let’s add web3js, I added a <a href="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/">web3js 1.0 from CDN JSDelivr</a> (note that currently 1.0 is a beta version, not stable). I know, the code is <em>even more</em> complex. Deal with it!</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;Test Opera&lt;/title&gt;<br> &lt;script src=&quot;https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  Working!<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>If we reload, on the Console, now, we can do this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*yVahxmJbHd6jz_wdT8wuYA.png" /></figure><p>Oh yeah! We gots web3js 🤗! Let’s do something more interesting now. On Opera desktop, I set it up to use the Ropsten testnet (dig around, you’ll find out how, you don’t need me to spell that out, do you?). Then I sent 💸some 0.1 test Ether (love me that funny money 🤑!) to that account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*KF13ebq0y7RQIQ5oPHplYw.png" /><figcaption>On the Opera Desktop Sidebar, clicking on the wallet icon</figcaption></figure><p>On Opera on Android, also connect to Ropsten (oh, ok, just click on the Opera O icon on the lower right &gt; Crypto Wallet &gt; Gear icon on top right &gt; Network) to make sure you’re on the same network, then we can play around on the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*3pb6cWNvRABS1zFX9cIpHg.png" /></figure><p>So, now we’ve connected to the Ethereum network and got the current account! Let’s get the balance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*chT7nQbP8EwOLkpWzRjTeg.png" /></figure><p>So we have 0.1 Eth or 100000000000000000 Wei on that account. Cool!</p><p>I wonder… Could we even send some Eth to another account? Let’s try…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gkDso5gK3y1bsKM2y8tMiQ.png" /><figcaption>Trying to send Eth…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pr1TnmHsHwdeJWhZdy2YmA.png" /><figcaption>Confirm to send Ether</figcaption></figure><p>Of course, it needs user authorization to allow the transfer, so it even popped up with a confirmation screen!</p><p>That’s damn cool! 😎</p><p>To add to the coolness, it even asked for my security pattern or fingerprint ☝ to authenticate the transaction. Loving it!</p><p>It also shows a transaction pending message, which allows you to click through to view the pending transaction on <a href="https://ropsten.etherscan.io/tx/0x66cd31f84c4e60bddf840f11ea444c198590fc4115d61ad8db2b99c40aad5eaa">Etherscan</a>. I’m impressed!</p><p>I did this twice because the screenshots weren’t great, so I received 0.02 ETH total, and it shows up on this account that I have set up on Metamask on a different browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*8lrkqSgcnDYVpniLBC4p_Q.png" /><figcaption>The account received the transaction.</figcaption></figure><p>All right! So let’s recap what we did:</p><ul><li>We used Opera on Windows and on Android.</li><li>We created an Ethereum Wallet on Window.</li><li>We synced the wallets on the two apps by scanning the QR Code</li><li>We connected the Android device via USB</li><li>We used adb to allow debugging Opera on Android</li><li>We created a very simple webpage and added web3js to it</li><li>We set it up to use the Ropsten testnet</li><li>We played around with the Ethereum account through the remote console</li><li>We sent Ether from that account to another account</li></ul><p>So now we have a mobile browser that can use Ethereum DApps! That’s pretty awesome on my book! I definitely look forward to using this.</p><p>Did you enjoy it? Drop me a message, let me know what you think. And check out the follow up story so you know how to <a href="https://medium.com/@rpaskin/wow-signing-a-message-on-opera-on-android-with-a-private-key-cff9bca84c06">sign a Message on Opera on Android With a New Private Key</a>.</p><p>Cheers,</p><p>— Ronnie</p><p><strong><em>P.S.</em></strong><em> For my fellow Portuguese speaking friends:</em> Gostou do conteúdo? Quer saber mais sobre programação de DApps com Ethereum? Dê uma olhada no meu curso de <a href="https://www.udemy.com/contratos-inteligentes/">Programação de Contratos Inteligentes com Solidity na Udemy</a>. É de graça, e o único curso do tipo em português! Ajude a divulgar, e quem sabe você possa ser aquele inscrito número 6000! Abraços!</p><blockquote>Also Read: <a href="https://medium.com/coinmonks/the-best-cryptocurrency-hardware-wallets-of-2020-e28b1c124069">Best Hardware Wallets</a></blockquote><figure><a href="https://coincodecap.com/?utm_source=coinmonks"><img alt="" src="https://cdn-images-1.medium.com/max/584/0*OJ-qb5G6i863msBB.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1fb1b0ba7bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/coinmonks/playing-with-ethereum-in-opera-for-android-d1fb1b0ba7bb">Playing With Ethereum in Opera for Android</a> was originally published in <a href="https://medium.com/coinmonks">Coinmonks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dietas Low-Carb]]></title>
            <link>https://rpaskin.medium.com/dietas-low-carb-110916b4844c?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/110916b4844c</guid>
            <category><![CDATA[dieta-low-carb]]></category>
            <category><![CDATA[dieta]]></category>
            <category><![CDATA[dieta-ceto]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Tue, 01 Aug 2017 19:42:08 GMT</pubDate>
            <atom:updated>2017-08-03T19:13:36.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QDkhYioQQz5C5ccrRhkGyQ.png" /></figure><p>Essa é uma história pessoal, mas toda minha vida tive problemas de peso, como muitos. (trocadilho proposital ;-)</p><p>Lembro, quando criança, do desconforto que o sobrepeso me causava emocional e fisicamente. Falta de auto-confiança, aversão à atividades físicas, bullying, introspecção em excesso… Lembro das tentativas da família de ajudar, levando para as aulas de natação muito cedo, trancando o armário de guloseimas (e eu sempre achando a chave), até a &quot;dieta da lua&quot; em que eu ficava um dia apenas ingerindo líquidos.</p><p>Nada parecia funcionar. Mesmo nos meus vinte-e-poucos anos, com uma reviravolta em uma direção positiva mental, emocional e muita atividade física, nunca me senti bem com meu corpo. Até, muito mais velho, achar uma dieta low-carb.</p><p>Para mim, a dieta certa finalmente me levou a um lugar de conforto com meu corpo e, acredito, a um equilíbrio hormonal em que meu peso e alimentação são sustentáveis a longo prazo. Em cerca de um ano, cheguei a um índice considerado apropriado de massa corporal (sim, há controvérsias quanto a índices, mas é uma métrica, melhor que nenhuma ou alguma desculpa esfarrapada) e venho mantendo o peso ha cerca de mais um ano. Finalmente, como nunca antes, pude usar roupas apropriadas para a minha altura. Entendi como as porções recomendadas na informação nutricional dos alimentos ou por nutricionistas são, sim, suficientes para te manter satisfeito (mas isso deve acontecer naturalmente, não acredito que forçar o limite das porções artificialmente seja sustentável a longo prazo.)</p><p><em>Disclaimer/ Aviso Importante:</em> Não acredite cegamente na minha palavra nem de ninguém mais. Apenas relato a minha experiência para tentar ajudar outros que tenham sofrido também. Nunca faça uma dieta sem saber bem o que está fazendo. Procure um nutricionista, nutrólogo, médico, etc. e estruture a coisa direito. Sua saúde depende disso.</p><blockquote>Não existe alimento saudável. Existe apenas alimentação saudável.</blockquote><p>Abaixo falo superficialmente de algumas diferentes dietas Low-Carb conhecidas.</p><h3>Ceto (Dieta Cetogênica)</h3><h4><a href="https://www.facebook.com/dietaceto">https://www.facebook.com/dietaceto</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*aH1yZtZCdP2l3SGLBFNzqg.jpeg" /><figcaption>Comidas apropriadas para dieta ceto, fonte: <a href="https://ketosource.co.uk/keto-shopping-list-uk/">https://ketosource.co.uk/keto-shopping-list-uk/</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*7ZZqR6VWom7BstzItsXShw.png" /><figcaption>Na dieta ceto, a maior parte de sua energia vem de gorduras</figcaption></figure><p>A dieta Ceto, ou cetogênica, foi o que funcionou bem para mim. Não é fácil no começo, mas vale a pena.</p><p>No fundo, é o recondicionamento do seu organismo para funcionar em cetose, ou seja, tirando sempre energia da gordura e não dos carboidratos.</p><p>Para garantir isso, fique sempre abaixo de 20 gramas de carboidratos por dia, <strong>mas com atenção.</strong> Isso exige muita conta, anotar e verificar exatamente o que e quanto está ingerindo, beber muita água, tomar cuidado com os sais minerais, eletrólitos, etc. Saiba quantas calorias de cada categoria você deve ingerir de acordo com seu peso, idade, nível de atividade física, etc. Nada de pão, farinha, arroz, batata, cerveja, cenoura, beterraba, grãos, quase nada de frutas, etc. Nada de dias de &quot;descanso&quot; ou &quot;reciclagem&quot;, senão seu organismo simplesmente sai da cetose e é difícil voltar. Mas vale a pena! Vasta variedade de alimentos saborosos (afinal, a gordura é saborosa e sacia a fome), níveis de energia altos, clareza mental, nada de passar fome e melhora em quadros inflamatórios, são algumas das vantagens dessa dieta (além da perda de peso).</p><h3>Dieta Paleolítica</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*28P0jlfo3boGGcPt1UppGA.png" /><figcaption>Uma pirâmide alimentar da dieta paleolítica, fonte: <a href="https://www.thefitglobal.com/7-days-paleo-diet-meal-plan-for-weight-loss/">https://www.thefitglobal.com/7-days-paleo-diet-meal-plan-for-weight-loss/</a></figcaption></figure><p>A dieta paleolítica tem inspiração no que (teoricamente) o homem da antiguidade comeria. Frutas frescas, oleaginosas (nozes, etc.), verduras, carnes. Nada de grãos ou laticínios.</p><h3>Dieta Bulletproof</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0-z9m7HuLXYajN1pZOFcg.jpeg" /><figcaption>Café a prova de balas, fonte Gabriel Goffi: <a href="https://www.youtube.com/watch?v=KllCMCfZoBk">https://www.youtube.com/watch?v=KllCMCfZoBk</a></figcaption></figure><p>Famosa pelo &quot;café à prova de balas&quot;, a dieta Bulletproof é uma dieta de alta gordura (70%) e tenta ao máximo evitar aqueles &quot;desejos&quot; quase incontroláveis de comer o que não deve, baseada em pesquisas científicas e testes empíricos para cada um achar sua melhor maneira de se alimentar.</p><h3>Dieta Atkins</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*2XkR5nt6wnvNNZg_lkRBgA.jpeg" /><figcaption>Dieta Atkins, fonte: <a href="https://www.atkins.com/how-it-works/atkins-20">https://www.atkins.com/how-it-works/atkins-20</a></figcaption></figure><p>A dieta Atkins se estrutura em estágios que vão retirar a maior parte dos carboidratos, e depois reintroduzir alguns, aos poucos. A grande &quot;vantagem&quot; é que ao final você pode, em moderação, acomodar alimentos que em outras dietas não seriam &quot;permitidos&quot;.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=110916b4844c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Código Omega]]></title>
            <link>https://rpaskin.medium.com/c%C3%B3digo-omega-2503ba4eacf6?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/2503ba4eacf6</guid>
            <category><![CDATA[ficcaocientifica]]></category>
            <category><![CDATA[portugue]]></category>
            <category><![CDATA[scifi]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Wed, 27 Jul 2016 19:25:06 GMT</pubDate>
            <atom:updated>2016-07-27T19:35:37.417Z</atom:updated>
            <content:encoded><![CDATA[<h4>Uma pequena história (de ficção?)</h4><p>“Espere um minuto… você está dizendo que eles são como os Schnisslu de Betelgeuse-VI?” “Não, Jefferson, escute o que estou falando! Eles não são controlados por uma outra espécie simbiótica!” “Ok … acho que entendi agora. Você deveria ter explicado antes, eles são como a mente-colméia Gorba que encontramos em Kitalpha-III, os indivíduos são apenas parte do …” “Jefferson, pare e me escute!” Dr. Steban interrompeu. “Eles são humanos, não alienígenas.” “Mas você disse…” “Eles ainda são humanos! Eu disse que eles são mutantes, mas ainda sim são humanos. Caramba, de acordo com meus testes genéticos, eles poderiam até cruzar com um de nós, apesar de altamente improvável, eles aparentemente também desenvolveram algumas práticas reprodutivas escandalosas. “ “Eu não entendo, Steb… Quero dizer, nós temos catalogado uma abundância de colônias humanas estranhas após a Grande Diáspora Galactica… estruturas sociais perversas, tecnologias auto-destrutivas, ridículas crenças religiosas… Lembra o último relatório do Time Azure? Mas nada chegou nem perto do que você está descrevendo. Como é possível seres humanos terem evoluído — o que você chamou de cérebros externos, bem como memórias compartilhadas???&quot; Dr. Steban sentou-se na estação de navegação da nave e comentou: “habilidades telepáticas também.” Comandante Jefferson sentou-se na cadeira do capitão. Isso sempre o ajudou a acalmar, se sentir no controle. “Isto é uma loucura. Então todos nascem assim?” “Bem, eu… não tenho certeza. Eles definitivamente recebem seus cérebros externos depois que eles nascem… alguns deles chegam até a transportar mais de um cérebro externo, e às vezes até trocam-nos uns com os outros… … até mesmo chegam a compartilhar seus cérebros.” “STEB, isso é completamente inacreditável. Eu nem sei como podemos informar informar isso ao HQ sem dizerem que estamos loucos. O que mais você sabe?” Dr. Steban suspirou. “Eu ainda não descobri exatamente como é que eles interagem tão completamente com os cérebros… Eu não era capaz de ver qualquer conexão com seu sistema nervoso real, exceto alguns fios que às vezes colam em seus ouvidos, mas sensores só mostram estes transportando ondas sonoras. Eu detectei muitas ondas eletromagnéticas irradiando ao redor, mas até quando posso dizer, eles ainda só basicamente usam as mãos, olhos e ouvidos.” “E sobre a telepatia, Steb, eu pensei que todas as pesquisas que já fizemos em xenobiologia provaram que os humanos não são capazes de desenvolver isso.” “Mais uma vez, Jefferson, é tudo através de seus cérebros externos. Os cérebros são capazes de se conectar uns com os outros, bem como a cérebros maiores que se espalham através de seu planeta.” “Mas o que sobre o que você disse … memórias compartilhadas?” “Sim, aparentemente, eles têm acesso quase instantâneo a este tipo de memória coletiva através de seus cérebros externos. Imagine isto Jefferson, qualquer coisa que você gostaria de saber, respostas para quase qualquer pergunta jamais respondida… em um piscar de olhos.” “Steb, isso é inacreditável, todos eles devem ser gênios!” Dr. Steban riu. Essa é a parte triste, Jefferson … Houve um pequeno acidente. Nada grave, eles nem sequer suspeitaram que eu estava sondando. Mas um dos testes que fiz interrompeu suas comunicações eletromagnéticas por algumas horas, e foi chocante ver. Jefferson, essas pessoas são idiotas! Eles não conseguem funcionar sem os seus cérebros externos! A maioria deles ficou simplesmente olhando para os cérebros. Alguns se perderam e não sabia onde estavam indo. Eles continuavam a mexer com seus cérebros mais e mais, mesmo sem efeito. Alguns deles ficaram tão frustrados que jogaram os cérebros no chão e os esmagaram. Jefferson, você pensou que eles não eram humanos antes… Se você tivesse os visto nessa situação… eles nem bem estavam conscientes! “Comandante Jefferson ficou em silêncio por um minuto, em seguida, sentou-se com a espinha ereta.” Dr. Steban, qual é o seu conselho oficial?” Steban reconsiderou por algum tempo, mas assim como o comandante, ele sabia que a conclusão era inevitável.” Eu tenho que assumir que isso pode ser contagioso, e eu não tenho certeza se é reversível. Eu recomendo um Código Omega, comandante Jefferson.” Jefferson suspirou. “Muito bem. Como comandante dessa missão, estou autorizando imediatamente um Código Omega completo. Este sistema ficará escuro para o resto da galáxia. Sinto muito Steb, seu relatório ficará bloqueado. Ninguém nunca vai lê-lo.” “Não se desculpe por isso Jefferson. Vamos apenas esperar que estes… este povo… nunca desenvolva a tecnologia de viagens espaciais. Pode ser o fim da humanidade como a conhecemos.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2503ba4eacf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ayn Rand e o Objetivismo]]></title>
            <link>https://rpaskin.medium.com/ayn-rand-e-o-objetivismo-ea55ee16b466?source=rss-21e54d4d6e71------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea55ee16b466</guid>
            <category><![CDATA[ayn-rand]]></category>
            <category><![CDATA[filosofia]]></category>
            <category><![CDATA[objetivismo]]></category>
            <dc:creator><![CDATA[Ronnie Paskin]]></dc:creator>
            <pubDate>Mon, 25 Jul 2016 13:03:07 GMT</pubDate>
            <atom:updated>2016-07-25T16:39:41.130Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/306/0*drTFd5w87ZYkZbbL." /><figcaption>A autora Ayn Rand em Manhattan, 1957 (Allyn Baum/ NY Times)</figcaption></figure><p>Ayn Rand, originalmente Alisa Zinov’yevna Rosenbaum (em russo Али́са Зино́вьевна Розенба́ум) foi uma escritora e filósofa nascida em 1905 na Rússia. Advinda de família burguesa, que perdeu praticamente tudo com a revolução russa, se mudou para os EUA em 1926, onde veio a falecer em 1982. Roteirista e escritora, seus dois livros mais conhecidos são “A Nascente” (1943) e “A Revolta de Atlas” (1957). Rand desenvolveu um sistema filosófico ao qual chamou “Objetivismo”, que apesar de historicamente ignorado ou rejeitado pelo meio acadêmico, vem ganhando mais consideração e em especial se provando muito influente na política norte-americana.</p><p>A filosofia de Ayn Rand se baseia na ideia que a realidade existe independentemente da consciência, e que os sentidos são o meio de contato com a realidade. Através desse contato e de lógica, pode-se obter conhecimento. Ela diz ainda que o propósito moral, honesto, da vida de um indivíduo é a busca da própria felicidade (o interesse próprio racional), e que o único sistema sócio-econômico consistente com esse ideal é o liberalismo econômico com o puro capitalismo (laissez-fare), e que o papel da arte na vida humana é transformar as ideias metafísicas, por reprodução seletiva, em uma forma tangível que seja compreensível e solicite respostas emocionais.</p><h3>Livros</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*Uhv0VtvYwFyeibLlGRGTSA.jpeg" /><figcaption>&quot;A Revolta de Atlas&quot; — &quot;Quem é John Galt?&quot;</figcaption></figure><p>A maior parte da filosofia de Rand é exposta em seus romances. Em “A Nascente”, o arquiteto Howard Roark se recusa a comprometer seus ideais artísticos e pessoais por mero sucesso e reconhecimento. Ele não adota, apesar da pressão, os métodos tradicionais reconhecidos e prefere seus próprios métodos modernos, que Roark considera superiores. O protagonista é o homem ideal de Rand, alguém que demonstra valor e integridade em relacionamentos com os outros personagens, incorporando assim a filosofia de Rand que o individualismo é superior ao coletivismo. O livro se tornou um filme estrelando Gary Cooper em 1949.</p><p>O livro mais famoso de Ayn Rand, “A Revolta de Atlas”, seu <em>magnum opus</em> de quase 1200 páginas em sua primeira edição, mistura romance, mistério e ficção científica em um futuro distópico nos EUA. Um grupo de industrialistas dos mais proeminentes decide abandonar uma sociedade que impõe regulamentações burocráticas, os impedindo de agir segundo seu melhor juízo e auto-interesse. A protagonista, Dagny Taggart, é constantemente impedida de agir da maneira que considera melhor para sua companhia ferroviária, e se depara repetidamente com a pergunta “Quem é John Galt?” Apesar de ser usada inicialmente como mera expressão para simbolizar qualquer incerteza, a resposta se mostra surpreendentemente mundana, quando Dagny encontra o próprio Galt no “Vale de Galt” junto com os outros “grevistas” que se retiraram da sociedade para priorizar suas convicções, honestidade intelectual e interesses próprios.</p><h3>O Objetivismo</h3><p>Rand dizia que o Objetivismo é uma “filosofia para a vida na terra”, baseada na realidade, com o objetivo de definir a natureza humana e do mundo em que vivemos. Ela chamaria essa filosofia de “existencialismo”, exceto pelo fato do nome já estar “tomado pelas filosofias de outros como Kierkegaard, Dostoyevsky, Nietzsche e Sartre. Ela era duramente crítica a praticamente todos outros filósofos exceto Aristóteles, e particularmente odiava Kant, a quem chamava de “monstro”.</p><p>Em “A Revolta de Atlas”, ela diz que “sua filosofia, essencialmente, é o conceito de que o homem é um ser heróico, com sua felicidade sendo o propósito moral da sua vida, conquistas produtivas suas atividades mais nobres, e a razão como o único absoluto.”</p><p>Como ela própria explicou em uma entrevista televisada em 1959: “Eu sou a criadora de um novo código de moralidade que até agora foi considerado impossível — basicamente, uma moralidade baseada não em fé, não em emoção, não em decretos místicos ou sociais arbitrários, e sim na razão […] O propósito moral mais alto é alcançar sua própria felicidade, e nenhum homem deve forçar outras pessoas, nem aceitar ser forçado. Cada homem deve viver sua vida para si e seguir seu interesse próprio racional.”</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1ooKsv_SX4Y%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1ooKsv_SX4Y&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1ooKsv_SX4Y%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e5b6ff837f991029c3a60eb659091fbd/href">https://medium.com/media/e5b6ff837f991029c3a60eb659091fbd/href</a></iframe><p>Os princípios da filosofia de Rand, que são considerados axiomáticos e portanto inescapáveis, são: existência, consciência e identidade.</p><p>Existência é o fato auto-evidente em que todo conhecimento se baseia: “algo que existe, existe”. E por existir, tem que ser algo, ou seja, ter uma identidade com uma natureza e atributos específicos, caso contrário, não existiria. Esse axioma se expressa na diferenciação de algo contra nada, enquanto a identidade se expressa em poder se diferenciar algo de outra coisa. Como disse Rand, “Uma folha… não pode ser vermelha e verde ao mesmo tempo, não pode congelar e queimar… A é A.” O objetivismo rejeita a existência de qualquer coisa que transcenda a realidade.</p><p>Consciência, segundo Rand, é a faculdade de “perceber aquilo que existe.” E ter consciência significa ter consciência de algo, o que só pode ser distinguido ou entendido quando a realidade é independente da consciência, e que essa só pode ser consciente de si mesma, até ser consciente de algo real. Ou seja, para os objetivistas a mente não cria a realidade, mas é um meio de descobri-la. Portanto, Rand rejeita qualquer tipo de teísmo subjetivo metafísico.</p><p>Para o Objetivismo, ação e causalidade são explicados pela lei da identidade. Entidades agem segundo sua natureza, e a observação dessas ações serve como base para conhecer a natureza dessas entidades.</p><p>Para se obter conhecimento além do que é perceptível, se necessita vontade (ou o exercício do livre arbítrio) e que se siga um método de validação através de observação, formação de conceito e raciocínio indutivo e dedutivo. Por exemplo, acreditar, por mais sincera que seja a crença, que existe uma civilização escondida no interior da Terra não torna isso realidade. Tem que se seguir um processo de prova baseado na realidade observável para estabelecer a veracidade da crença.</p><p>A teoria de percepção, segundo o Objetivismo, distingue forma e o objeto, e diz que a forma percebida é determinada pela fisiologia do sistema sensorial de quem percebe. Portanto, a forma percebida é a realidade. Rand rejeita a dicotomia de Kant entre “coisas como as percebemos” e “coisas como são por si próprias”. Ela não aceita como fato que o conhecimento adquirido por um processo de consciência é subjetivo e não corresponde à realidade, pois afirma que todo conhecimento advém de um processo de consciência, sensorial, perceptual ou conceitual. Conhecimento sem processo de consciência, portanto, não existe.</p><p>Rand elabora bastante em sua epistemologia o aspecto de formação de conceito, descrevendo o processo de formação de conceitos como um processo de omissão de medidas, em que um grupo de objetos concretos, com similaridades que os distinguem, é <em>integrado</em> em uma nova unidade mental: o conceito, que omite as medidas particulares dos objetos similares. Conceitos são organizados hierarquicamente, podem ser diferenciados ou integrados, ou abtraidos em “conceitos de conceitos” (como rotweiller/ poodle -&gt; cachorros -&gt; animal -&gt; organismos vivos). Como conceitos são vistos como “abertos”, a epistemologia objetivista rejeita a distinção analítica-sintética bem como qualquer tipo de conhecimento <em>a priori</em>.</p><p>Quanto à sentimentos, Rand os rejeita categoricamente como fonte de conhecimento. Ela aceita que eles são importantes para os seres humanos, mas argumenta que são uma consequência de ideias já aceitas pela pessoa, conscientemente ou não. Ela também rejeita toda forma de fé e misticismo.</p><p>O Objetivismo aceita o fato de que pessoas têm conhecimento limitado e podem errar. Portanto, a certeza sobre proposições vem da verificação das evidências e da integração, por lógica, com o resto do seu conhecimento.</p><h3>Ética e Política</h3><p>Para Ayn Rand, o livre arbítrio do homem o leva à escolha de suas ações e valores. Ela acredita que esses valores não são inerentes e o processo de pensar sobre suas ações não é automático, e sim um ato de vontade. A pessoa pode escolher seu próprio bem-estar, ou não. Rand considera que, em se colocando a vida como objetivo primário e em função do livre arbítrio, a escolha moral correta é prezar sobretudo a própria sobrevivência e bem-estar, de forma racional. Portanto, segundo ela, o correto é o interesse próprio (ou egoísmo) ético, e a rejeição de uma doutrina ética altruista, resumida no voto de John Galt: “Eu juro pela minha Vida e pelo amor que tenho a ela que nunca irei viver em função de outro homem, nem vou pedir a outro homem que viva em função de mim.“</p><p>Para os objetivistas, o corolário do interesse próprio ético é que o único sistema social consistente com essa moralidade é um que respeite os direitos pessoais, a propriedade individual e não se imponha à força. Ou seja, o capitalismo laissez-faire.</p><p>A defesa da liberdade individual e a habilidade de exercitar seu livre arbítrio é essencial para Rand, sendo o que demonstra o valor heróico do homem. Portanto, o uso de força poderia impedir o uso da racionalidade e qualquer tipo de organização humana ideal necessita de cooperação voluntária e nunca mediante força. Persuasão é o método da razão, não força. Liberdade e razão andam de mãos dadas, o uso de força (ou ameaça de força, fraude, etc.) só se dá por necessidades irracionais que não podem persuadir os outros.</p><p>Portanto, para o objetivismo, o governo legítimo deve ser responsável por garantir leis bem definidas que defendam a liberdade dos cidadãos de forma que esses possam exercitar sua razão e defender seus interesses próprios e direitos individuais.</p><p>Rand se opunha a qualquer tipo de racismo legal (inclusive ações afirmativas racias, as quais considerava racistas), defendia o direito a abortos legais, se opunha ao alistamento forçado, se opunha a qualquer tipo de censura. Historicamente, objetivistas são contra vária políticas comuns de governos como: leis antitruste, salários mínimos, educação pública, leis contra trabalho infantil, apoio a iniciativas de instituições religiosas, e até mesmo impostos.</p><p>Até os dias de hoje, vemos sua grande influência na Política. Paul Ryan, atual (2016) presidente da câmara dos deputados do congresso nacional dos EUA, citou Ayn Rand como sua inspiração para se involver no serviço público, chegando até a dar cópias de “A Revolta de Atlas” para seu gabinete como presentes de natal. (É interessante notar que mais tarde Paul Ryan rejeitou publicamente essa posição, possivelmente devido a críticas da filosofia de Rand como uma filosofia de ateísmo, impalatável para o público em geral).</p><h3>Conclusão</h3><p>A escrita de Rand, apesar de dramática, deixa a desejar nos quesitos nuance, sutileza e estética. Os personagens demonstram suas convicções e filosofia de forma dramática: o interesse próprio ético, racionalidade, honestidade, justica, independência, integridade, produtividade e orgulho. Entretanto, carecem de profundidade; parecem sub-arquétipos, caricaturas que, apesar de segundo declarado pela própria autora não serem simbólicos, demonstram o efeito na sociedade do fascismo, socialismo, comunismo, burocracia e o potencial negativo da falta dos líderes industrialistas. Literalmente temos centenas de páginas de solilóquios por dublês da autora, expondo suas convicções em desafio “ao mundo que está contra eles” (O discurso final de Galt se estende por sessenta páginas e levou dois anos para ser escrito por Rand). Notadamente, não vemos os detalhes pragmáticos de como essa sociedade liberalista anarco-capitalista, voltada para o interesse próprio, funcionaria na prática.</p><p>O mote de seu clássico “A Revolta de Atlas” é claro: se, como Isaac Newton disse, estamos “de pé sobre ombros de gigantes,” o que aconteceria se os gigantes fizessem greve devido à miudeza mental dos anões? Lembra de certa forma os aforismos de Nietzsche, capazes de engajar alguns de forma dramática, apesar de limitados em termos de estrutura estética e didática.</p><p>Parece claro e compreensível, dado a história pessoal da autora, que sua ética seja a antítese da ética Bolchevique de Lenin, responsável direta pelas perdas sofridas por Ayn Rand e sua mudança para os EUA, longe de sua família. É ainda natural que, dada as publicação de “A Revolta de Atlas” durante o período da guerra fria e do McCarthismo, com um discurso claramente anti-comunista e, ainda mais, por uma autora russa, essa filosofia tenha tomado um vulto maior e ganhado maior visibilidade e apoio.</p><p>Entretanto, o apelo racional e emocional de seus preceitos é claro: você, indivíduo (que se acha) racional, pode e deve ter controle sobre sua vida, e não deve deixar que outros digam o que fazer. Isso ressona em especial com pessoas com egos inflados como adolescentes, aterrorizados por serem obrigados a fazer o que não querem ou de forma que não acham ideal. Ser egoísta é bom.</p><p>O mundo de Rand é preto e branco. Ou o indivíduo é racional ou não, bom ou não, tem valor ou não. Pode ser que isso funcione em sua ficção, mas o mundo real, e as pessoas, tem tons de cinza, algo que Rand se recusa a considerar.</p><p>É interessante notar que ao final de sua vida, Rand recebia aposentadoria de programas sociais do governo, o que muitos criticaram como hipocrisia.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea55ee16b466" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>