<?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 Rafa de Castro on Medium]]></title>
        <description><![CDATA[Stories by Rafa de Castro on Medium]]></description>
        <link>https://medium.com/@rafadc?source=rss-65f8067536c0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*jIQovTkFzsUuOvqn3FBiqA.jpeg</url>
            <title>Stories by Rafa de Castro on Medium</title>
            <link>https://medium.com/@rafadc?source=rss-65f8067536c0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 16:18:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rafadc/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[Playing with text to speech in emacs (part 1)]]></title>
            <link>https://medium.com/@rafadc/playing-with-text-to-speech-in-emacs-part-1-9b0428dd7480?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b0428dd7480</guid>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Thu, 15 Dec 2016 23:00:00 GMT</pubDate>
            <atom:updated>2016-12-16T10:06:50.478Z</atom:updated>
            <content:encoded><![CDATA[<p>Amazon has just announced Polly and I wanted to give it a try. Of course the first thing that came to my mind was: <a href="https://github.com/skeeto/elfeed">elfeed</a>! Polly is not free but 4$ per 24 hours seems reasonable in order to read a post from time to time. Anyway let’s start there, get the ball rolling, and if it works well maybe we can think in adding more backends.</p><p>So, let’s go to work!</p><p>I was trying the command line and it looked good enough for me. If you have aws-cli tools installed it is enough a mere:</p><p>aws polly synthesize-speech \ — output-format mp3 \ — voice-id Joanna \ — region eu-west-1 — text “We are about to have a lot of fun!” \ hello.mp3</p><p>to get an mp3 downloaded into your machine. With that, probably we can have just enough.</p><p>Let’s go to emacs. I just added to my config the following function:</p><p>(defun my/elfeed-send-to-tts () “Send current article to a text to speech system” (interactive) (let* ((html-to-read (elfeed-deref (elfeed-entry-content elfeed-show-entry))) (text-to-read (replace-regexp-in-string “&lt;.*?&gt;” “” html-to-read)) (temp-input-file (make-temp-file “elfeed-input-tts”)) (temp-output-file (make-temp-file “elfeed-output-tts” nil “.mp3”)) (polly-command (concat “aws polly synthesize-speech — region eu-west-1 — output-format mp3 — voice-id Joanna — text \”$(&lt; “ temp-input-file “)\” “ temp-output-file ))) (progn (write-region text-to-read nil temp-input-file) (shell-command polly-command) (shell-command (concat “open -g “ temp-output-file)))))</p><p>Elfeed retrieves the content in HTML so the first thing I have to do is get the raw text</p><p>((html-to-read (elfeed-deref (elfeed-entry-content elfeed-show-entry))) (text-to-read (replace-regexp-in-string “&lt;.*?&gt;” “” html-to-read))</p><p>Then, in order to be easier to me to work with the command line I just created a temporary file to store the text and a temporary file that will hold the mp3 of the text</p><p>(temp-input-file (make-temp-file “elfeed-input-tts”)) (temp-output-file (make-temp-file “elfeed-output-tts” nil “.mp3”))</p><p>I still need to investigate if the output file is correctly disposed since I will be overwriting it with the shell.</p><p>The rest is pretty obvious. We just prepare the command:</p><p>(polly-command (concat “aws polly synthesize-speech — region eu-west-1 — output-format mp3 — voice-id Joanna — text \”$(&lt; “ temp-input-file “)\” “ temp-output-file )))</p><p>then prepare the input and fire the command</p><p>(write-region text-to-read nil temp-input-file) (shell-command polly-command)</p><p>I’m using a little bash trick</p><p>$(&lt; input_file)</p><p>That will put the file contents in the command. Probably I will have to escape the output somehow but this is my first approach. Let’s add this to the TODO list and continue.</p><p>Finally to play it I will use another dirty trick. This will only work in macOS at the moment.</p><p>(shell-command (concat “open -g “ temp-output-file))</p><p>This will open the default mp3 player in the background and read the text.</p><p>With this we have:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTvjc9eVG1uo%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTvjc9eVG1uo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FTvjc9eVG1uo%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/890b5c90d7133af0444811bb5facbd77/href">https://medium.com/media/890b5c90d7133af0444811bb5facbd77/href</a></iframe><p>So at least we have something working. We have still some problems with escaping the input text. Also I found that the command line has a limitation of 1000 characters. We will deal with this problems in further posts.</p><p><em>This article was originally posted </em><a href="http://joy.pm/2016/12/16/playing_with_text_to_speech_in_emacs_(part_1).html"><em>on my own site</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b0428dd7480" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On apologies]]></title>
            <link>https://medium.com/@rafadc/on-apologies-7e5ac9388e97?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e5ac9388e97</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[relationships]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Wed, 07 Sep 2016 10:49:52 GMT</pubDate>
            <atom:updated>2016-09-07T10:49:52.767Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s start by saying that I’m far from expert on this. Honestly I’m just writing this so I can link it afterwards in case I ever need it.</p><p>Most of us do apologies wrong. Yup. Sorry. This is something that should be easy but in my opinion it is super difficult.</p><h3>The non-apologetic apology</h3><blockquote>I’m sorry if I hurt you…</blockquote><p>What kind of non apology is that? I’m sorry <strong>***IF***</strong> I hurt you? 99% of the times this is said in the context where you definitely know that you caused harm with your words. This is like trying to move the burden of the guilt to the person being harmed because he was hurt because he wasn’t able to cope with the hurting element.</p><p>Forget about that. You did harm and you know it.</p><h3>The justification</h3><blockquote>Sorry, I hurt you but you…</blockquote><p>But… my ass. You hurt the other person. Please, focus on that first. Solve that and once the apology is accepted we can move on to different things. Do not try to save face. The other person has been hurt. That is priority nr 1. You saving face may come after.</p><p>This has also a beautiful connotation: It often continues like</p><blockquote>Sorry, but I didn’t intended to hurt you…</blockquote><p>Brilliant. Not it is the hurt person’s fault. You are not responsible for your words. You are not responsible for being misinterpreted.</p><h3>Acknowledge</h3><blockquote>I’m sorry. I shouldn’t have said that.</blockquote><p>First of all acknowledge that you made a mistake. All humans do. To be honest it is not such a big deal. No ego should be hurt.</p><h3>If needed, try to avoid it in the future</h3><blockquote>I’m sorry. I shouldn’t have said that. I will do … for this not to happen again.</blockquote><p>Try to expose your next steps for the hurting event not to happen again. Probably you can get a nice feedback.</p><h3>If appropriate, involve the hurt person in finding the solution</h3><blockquote>I’m sorry. I shouldn’t have said that. What do you thing about me doing … for this not to happen again?</blockquote><p>You are making the other person part of the solution instead of a problem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e5ac9388e97" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sending to pocket from elfeed]]></title>
            <link>https://medium.com/the-joy-of-coding/sending-to-pocket-from-elfeed-f0702bd5f08a?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0702bd5f08a</guid>
            <category><![CDATA[pocket]]></category>
            <category><![CDATA[emacs]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Thu, 18 Aug 2016 22:53:04 GMT</pubDate>
            <atom:updated>2016-08-28T09:34:04.719Z</atom:updated>
            <content:encoded><![CDATA[<p>I often use <a href="https://github.com/skeeto/elfeed">elfeed</a> to go quickly through my RSS subscriptions. There are some of them that I want to take more time to read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*nXNL3K59EQGBxHmbj4ZieQ.png" /><figcaption>Yes, it is mostly text but it is super useful.</figcaption></figure><p>I send the entries that I need more time to read to <a href="https://getpocket.com/">pocket</a>. I do that because I can use pocket client in my mobile phone or in the desktop or wherever the hell I am. I can also use any spare moment in the bus or the airplane even without internet access.</p><p>Elfeed by default has nothing like a pocket integration but as you’ll probably know emacs lisp is always here to help.</p><p>One of the less known pocket features is the possibility to send links via email. We will make good use of it. Remember that you need to send the email from the same email address you have in pocket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*KJ5Oq6pTZQwm4-Xy0VvwOw.png" /></figure><p>In order to send emails I am using Msmtp. My configuration for gmail is something like:</p><pre>account default<br>host smtp.gmail.com<br>port 587<br>protocol smtp<br>auth on<br>from my.email@gmail.com<br>user my.email@gmail.com<br>password application.password<br>tls on<br>tls_nocertcheck</pre><p>Remember to create an application password for this. Never use your main password ;)</p><p>Msmtp is a beautiful tool to send email. You can send an email from the command line just with:</p><pre>echo &quot;Hey!!!!&quot; | msmtp recipient@mail.com</pre><p>That said let’s create the binding in elfeed config. If we check the source for elfeed show we can see that we can retrieve the URL of the current entry with:</p><pre>(elfeed-entry-link elfeed-show-entry)</pre><p>Piece of cake. Let’s then let’s define an interactive function to send the email:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22598784fd6633d512926824a749abe9/href">https://medium.com/media/22598784fd6633d512926824a749abe9/href</a></iframe><p>I always add the final message to remember what is happening and avoid having an impossible to understand message like “Shell command successful” in the editor.</p><p>Now in my use-package for elfeed I only need to add the following in the config section</p><pre>:config       <br>  (bind-keys :map elfeed-show-mode-map<br>                  (&quot;x&quot; . elfeed-send-to-pocket))</pre><p>This way when in an article I can just press x and the article will be saved to pocket.</p><p>Happy emacsing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0702bd5f08a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/sending-to-pocket-from-elfeed-f0702bd5f08a">Sending to pocket from elfeed</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to rewrite]]></title>
            <link>https://medium.com/the-joy-of-coding/when-to-rewrite-21a9a3c3d108?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/21a9a3c3d108</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Mon, 13 Jun 2016 13:32:45 GMT</pubDate>
            <atom:updated>2016-06-13T13:32:45.256Z</atom:updated>
            <content:encoded><![CDATA[<p>We all heard it. Probably some of us lived it. That beautiful moment when somebody asks: “why don’t we rewrite our full application?”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*ksdpItuqJJshToI3D39RaQ.png" /></figure><h3>Things to consider before starting</h3><p>I always said that we humans have the beautiful power of learning from other people’s experiences so let me tell you mine:</p><ul><li>You will <strong>always</strong> lose features. Nobody knows completely what the application does up to the smallest detail. Nobody knows all the corner cases. Nobody remembers all the small decisions taking meanwhile wrig the application.</li><li>A rewrite <strong>always</strong> takes longer than expected. Different orders of magnitude.</li><li>Seriously. A rewrite will seem to be <strong>endless</strong>.</li><li>A rewrite is a marathon, not a sprint. It’s chemotherapy, not some pills.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*l60XfnwJVXIY1uBsbhUxOg.png" /></figure><ul><li>The result may be better than what we had before in terms of speed, usability and maintainability. The problem is that the result may not be better and the customers may still prefer the old version.</li><li>The sum of the cost may be smaller than the cost of evolving but you are not giving new value to the customers during the rewrite.</li><li>If you improve the original application you are making the rewrite harder and maybe the rewrite becomes more expensive that adapting the old product. You are moving the target meanwhile you rewrite.</li><li>If switching technologies you need all the team to be trained again. All of it. Not only coders.</li></ul><h3>Why a big rewrite looks awesome?</h3><ul><li>It puts a “fixed” date to the end of all your problems. <strong>It brings hope</strong>. Anyway careful about short (4–5 months) schedules. When you have a cancer you should not trust the shaman that says that it can be fixed imposing his hands.</li><li>A rewrite has not to fight with hard truths because it is not in production by definition. You are making an imaginary product fight vs a real one.</li><li>New and exciting technologies! Often the technical team is keen on the idea because it gives them the possibility of ditching the old system with all its defects and play with new toys.</li></ul><h3>Things to NEVER do</h3><ul><li>Switching technologies without taking the team into consideration. The team is going to maintain the product long-term wise. Make them part of it.</li><li>Counter-strike rewrites: A terrorist comes, drops the bomb and then runs away. Maybe he hides and defends it for a while but he will finally gets the fuck out before everything blows up. Do NOT leave this to something whose future is not at stake in the rewrite. Do NOT make an external team alone to do the rewrite.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*BcKy9LTeAhptubkIsnKrNg.png" /></figure><ul><li>Forget about the parts that brought us money of the old system since we are too focused on its defects.</li></ul><h3>When you should make a rewrite</h3><ul><li>When you are changing <strong>WHAT</strong> the application does. If the new app is remarkably different it is perfectly fine to rethink and rewrite. It may even be good idea freeing your hands from old restrictions.</li><li>When you have some constraint that forces you to rewrite. For example, the programming language you are using will no longer be supported or works only in a weird kind of hardware that you will no longer have access to.</li><li>You have reached the technology limit. You are Facebook, or Google or Google and Facebook together.</li><li>When you are fully committed to it. You need to allocate a huge chunk of time just to do it. Be prepared to invest a ton of time and money on it.</li></ul><h3>Bibliography</h3><p>I leave this for the end because those are far better posts than mine:</p><ul><li>Joel Spolsky on why you should never rewrite: <a href="http://www.joelonsoftware.com/articles/fog0000000069.html">http://www.joelonsoftware.com/articles/fog0000000069.html</a></li><li>DHH on their success rewriting: <a href="https://signalvnoise.com/posts/3856-the-big-rewrite-revisited">https://signalvnoise.com/posts/3856-the-big-rewrite-revisited</a></li><li>Dharmesh Shah on rewritees: <a href="http://onstartups.com/tabid/3339/bid/97052/How-To-Survive-a-Ground-Up-Rewrite-Without-Losing-Your-Sanity.aspx">http://onstartups.com/tabid/3339/bid/97052/How-To-Survive-a-Ground-Up-Rewrite-Without-Losing-Your-Sanity.aspx</a></li><li>A chapter of the bike shed on rewrites: <a href="http://bikeshed.fm/58">http://bikeshed.fm/58</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21a9a3c3d108" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/when-to-rewrite-21a9a3c3d108">When to rewrite</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compiling Emacs]]></title>
            <link>https://medium.com/the-joy-of-coding/compiling-emacs-bf101720ce49?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf101720ce49</guid>
            <category><![CDATA[emacs]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Sat, 07 May 2016 09:06:51 GMT</pubDate>
            <atom:updated>2016-05-07T09:09:32.041Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s go bleeding edge!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Nhk3MiB3Qks4sEnnrDvM7Q.png" /></figure><p>Just:</p><pre>git clone git://git.savannah.gnu.org/emacs.git<br>./autogen.sh<br>./configure --with-ns<br>make bootstrap<br>make<br>make install</pre><p>I’m compiling the OsX version. In linux probably you will not need the with-ns flag. After some minutes you own built Emacs.app will be in the nextstep folder. The last “make install” does not actually install anything but it just copies several things into the Emacs.app so it is ready to work. That step deceived me a lot because I lost some time trying to make the thing work due to me thing that would install something.</p><p>It will take a huge amount of time but that is life.</p><p>The last 25 version (at the moment of writing 24 is in homebrew) is blazingly fast so probably I will try to stick to this for some time.</p><p>There are some things that are a bit unintuitive. You can directly alias emacs and emacsclient commands. I had to create two shell scripts in my path like</p><pre>#!/bin/sh<br>/Applications/Emacs.app/Contents/MacOS/Emacs “$@”</pre><p>Now you can have at last a working <em>emacsclient -nw.</em></p><p>Happy compiling!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf101720ce49" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/compiling-emacs-bf101720ce49">Compiling Emacs</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The black art of commit messages]]></title>
            <link>https://medium.com/the-joy-of-coding/the-black-art-of-commit-messages-b81e9bae07dc?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/b81e9bae07dc</guid>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Tue, 05 Apr 2016 22:42:53 GMT</pubDate>
            <atom:updated>2016-04-05T22:42:53.537Z</atom:updated>
            <content:encoded><![CDATA[<p>Good commit messages are the unicorn of the person maintaining legacy code. I will try to review some commit messages I’ve found over the years with its pros and cons.</p><p>I’ll break this into two categories: solving bugs and adding features.</p><h4><strong>Solving bug commit messages</strong></h4><blockquote>Fixing code</blockquote><p><strong>Pros</strong>: At least it is not destroying code</p><p><strong>Cons</strong>: What the hell is happening there? I can commit anything under that excuse</p><p>More specific brief</p><blockquote>Fixing bug</blockquote><p><strong>Pros</strong>: At least it is not introducing bug.</p><p><strong>Cons</strong>: What the hell is happening there?</p><blockquote>Making it work again</blockquote><p><strong>Pros</strong>: It is working… again</p><p><strong>Cons</strong>: Why wasn’t it working before?</p><blockquote>Fix bug in module X</blockquote><p><strong>Pros</strong>: Module X has one less bug</p><p><strong>Cons</strong>: At least I have a bit more context. Too bad I could deduct that information from the diff.</p><blockquote>Fix #23344</blockquote><p><strong>Pros</strong>: I have a ton more context of the reason behind the error. Unfortunately I don’t have it immediately. If I use a modern issue tracking system I can navigate to a discussion regarding this bug from my browser or editor.</p><p><strong>Cons</strong>: I have to go to my issue tracking system</p><blockquote>Fix #23344 Removing n+1 problem</blockquote><blockquote>The problem was that these lines were causing a nasty n+1 problem because we have a lot of entries in our “users” table.</blockquote><p><strong>Pros</strong>: I immediately have all the context of why the change was made and what the guy that had written this piece of code thought he was doing.</p><p><strong>Cons</strong>: A bit verbose sometimes</p><h4>Adding feature commit messages</h4><blockquote>test / testing / just testing</blockquote><p><strong>Pros</strong>: The code is probably tested</p><p><strong>Cons</strong>: Everything else</p><blockquote>Renaming method</blockquote><p><strong>Pros</strong>: Probably the new name is better</p><p><strong>Cons</strong>: I saw it in the diff already. Why it is a better name?</p><blockquote>Refactor</blockquote><p><strong>Pros</strong>: No behaviour was changed.</p><p><strong>Cons</strong>: Just kidding. Please, tell me why you needed to refactor this.</p><blockquote>Applying observer pattern</blockquote><p><strong>Pros</strong>: You know design patterns.</p><p><strong>Cons</strong>: Why is that a good idea in that scenario?</p><blockquote>Added new stories notification</blockquote><blockquote>This feature was requested in #112233</blockquote><blockquote>We are adding two new methods in the API so we can integrate in the future easier in our mobile app. These methods are now used in the frontend only.</blockquote><p><strong>Pros</strong>: A lot.</p><p><strong>Cons</strong>: Verbose</p><h4>Putting it all together</h4><p>When I look into a commit message, often, I am desperately looking for the reason <strong>why </strong>the change was made. I don’t want to know what changed. There is a diffing tool for that. It does not hurt if it is briefly describe what is done in the commit message but the most important part is why the change was made. When I read a commit message it often means that I am investigating a problem in the code so I need to know your assumptions to see if you were wrong or the assumption is now not valid.</p><p>Have some empathy with a person investigating something wrong with your work, most probably, your future self.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xL1IrGao7fTw0T0u_9edg.png" /></figure><p>With the diff I can already see what changes were made. The text just explains what the hell I was trying to do and more importantly why. This gives the investigator a great deal of information to know if I was wrong in case something needs to be fixed.</p><p>This is one of the reasons I am starting to avoid using the -m switch of git commit</p><blockquote>git commit -m “I did something with the code”</blockquote><p>If we commit like that we are encouraging small commit messages and it becomes too tempting not to explain a little bit to the next programmer.</p><p>That is, also, why these days I’m embracing the idea of interactive rebasing my branches before merging to the main branch. This gives me some introspection time to organize the commits appropriately and reword some commit messages to make the lives of future readers better.</p><p>Now probably a ton of people will come with better ideas than this for commit messages. New ideas are welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b81e9bae07dc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/the-black-art-of-commit-messages-b81e9bae07dc">The black art of commit messages</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ambition]]></title>
            <link>https://medium.com/the-joy-of-coding/ambition-cc167cf60475?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc167cf60475</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[hiring]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Fri, 01 Apr 2016 20:53:43 GMT</pubDate>
            <atom:updated>2016-04-01T20:53:43.612Z</atom:updated>
            <content:encoded><![CDATA[<p>Now that we are hiring at <a href="http://platform161.com/">Platform161</a> I spent some time thinking about values and culture at the workplace. There is one term that, in my opinion, is completely misunderstood. <strong>Ambition</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGDn670lAQlX5uvMk0-ofg.jpeg" /></figure><p><strong>Warning</strong>: All the things I am about to write are my opinions and of course they are highly opinionated.</p><p>We had a discussion because of a candidate that came here saying that he aspired to manage a team of people in 5 years. In my opinion that is not what I’d like to see. Why? That is not the kind of ambition I want to see. That is climbing the ladder.</p><h4>The question</h4><blockquote>What are your goals? What do you want/like to do?</blockquote><p>I want to know what drives a candidate. What he likes to do with his life. I want to ensure that I am able to provide and he is aligned with us.</p><h4>Not so good answer</h4><blockquote>I want to follow the career plan. I want to manage 5 people in X years.</blockquote><p>You being in a position of having people under your responsibility is not a goal. Is a consequence. Also I’m hiring somebody whose goal is not what he is going to do. His efforts will be focused on switching positions instead of getting better.</p><h4>Better answer</h4><blockquote>I’d like to learn X,Y and Z. I’d like to do A, B and C. All those things are supposed to be done here in the position I’m getting in.</blockquote><p>I am able to say if am am able to make you reach your goals. I am able to see if you will be happy here. I am able to see if the company will get profit for you achieving your goals.</p><p>This is the <strong>ambition</strong> I love. You want to become better. It won’t be you against your peers. It will be you against yourself.</p><p>For me, finding a person that wants to become a manager is a warning point. Really. The best managers I’ve ever met didn’t want to become managers. Let me write it in a bigger font.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Ldo11jqMORW9lO75XHrGvg.jpeg" /></figure><blockquote>The best managers I’ve ever met didn’t want to become managers.</blockquote><p>If you are responsible for a team the worst thing you can do is become different. The kind of management that always worked for me is the kind of role model you can identify with. As a “managee” you want to somehow become that person. You don’t want that person’s position. He wants the same kind of things you want. You are all in the same boat.</p><p>If a software developer joins the team I work in I want him to become a better developer. That is what I aspire too and we all can go in the same direction. We can help each other.</p><p>There is some funny thing about the wrong kind of ambition. I think that deep inside it is only that they want a better salary disguised in wanting a different position. There is nothing wrong with ambitioning a better salary. But why don’t people want a better salary by being more valuable instead of being in a more expensive position? Why don’t you start in the kind of work you want to do?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCixZhJCEb_QGp-JtipoVg.jpeg" /></figure><p>Maybe all this is because I am a software developer and I deeply love my profession. I can’t see myself doing a different thing. Maybe it is because of that that I like to be in a corporate culture where we all go together to the same goal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc167cf60475" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/ambition-cc167cf60475">Ambition</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A warm welcome to MS Sculpt keyboard]]></title>
            <link>https://medium.com/the-joy-of-coding/a-warm-welcome-to-ms-sculpt-keyboard-ee46c12d2070?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee46c12d2070</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[keyboard]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Tue, 21 Jul 2015 20:37:26 GMT</pubDate>
            <atom:updated>2015-07-21T20:37:26.821Z</atom:updated>
            <content:encoded><![CDATA[<p>I just moved to a new Microsoft Sculpt keyboard. I am more than happy with it. I wanted to move to a split keyboard for a long time but I never had the guts to try. Indeed I wanted to move to a Model 01 but this makes a good intermediate step.</p><p>This is the first Microsoft product that I buy that feels really beautiful. It is really nice to have it in your table.</p><p></p><p>The position of the hands is really comfortable although a bit odd because it makes your wrists to stay horizontal. It feels strange in the beginning but the position is super relaxed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2eyh4R-sa5ZfoXNLuqjhEA.jpeg" /></figure><p>There is a small detail I also love and it is that the spacebar is broken into two. Probably this is a really small detail but if I press it with a thumb the other thumb is not affected.</p><p>The keyboard is not bluetooth but comes with a small USB 2.4Ghz adapter which may not be ideal but is nice enough.</p><p>I don’t like noisy keycaps and in this laptop they are really silent. The pulsation is a bit mushy but if you come from a Apple keyboard like me this will feel super fine.</p><p>I was able to customize it to my taste using Karabiner which is an awesome tool for OsX. Also it allowed me to do some small hacks.</p><h4>Remap CapsLock to control</h4><p>Of course I do this to every new computer I get. This saves a lot of pinky emacs pain.</p><h4>Switch between Alt and Command</h4><p>In the sculpt keyboard these two keys are reversed in relation to where they are in a regular mac keyboard.</p><h4>Use CTRL+IJKL for cursor</h4><p>This is really awesome. I’m really enjoying this. Now I no longer have to move my hands to the arrow keys for moving the cursor. I find this also saner than Vim’s hjkl. I did this because in my opinion the cursor keys in the sculpt are really uncomfortable to reach and now I did this change also in my laptop’s integrated keyboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7RtG3tC3pzG1lr8jvxikw.jpeg" /></figure><p>In conclusion, I’m super happy with my acquisition. This is a really nice addon to my setup. I’m looking forward to get really used to it and next year I will aim for a Model 01.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee46c12d2070" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/a-warm-welcome-to-ms-sculpt-keyboard-ee46c12d2070">A warm welcome to MS Sculpt keyboard</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pairing over Tmux]]></title>
            <link>https://medium.com/the-joy-of-coding/pairing-over-tmux-561e0682d996?source=rss-65f8067536c0------2</link>
            <guid isPermaLink="false">https://medium.com/p/561e0682d996</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tmux]]></category>
            <category><![CDATA[pair-programming]]></category>
            <dc:creator><![CDATA[Rafa de Castro]]></dc:creator>
            <pubDate>Sat, 11 Jul 2015 12:15:16 GMT</pubDate>
            <atom:updated>2015-07-11T12:15:16.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Tmux is an awesome tool. One of its greatest uses is that is allows us to pair if you share the session. Anyway the setup is always a little bit complicated if you want to do it really right. Let’s see what we can do.</p><h3>The simplest scenario</h3><p>Let’s start in our computer all alone. Tmux sessions are run by a daemon the same way as screen does.</p><p>Let’s create a new session where we will pair</p><pre>tmux new-session -s pair_programming</pre><p>Now if you open a new terminal window you can attach your console to the same session.</p><pre>tmux attach-session -t pair_programming</pre><p>Then you are sharing the session in the same computer. Easy, isn&#39;t it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dOcQt_LKmIu2NGsy69ArgA.gif" /></figure><p>Even this may be impressive it’s not very useful.</p><h3>In the same network</h3><p>Now let’s try something a bit better.</p><p>We just saw that we can share a tmux session between two terminal sessions. Then we have a simple way of sharing the session over the network. We can simply make other user to ssh into your computer and run tmux from there.</p><p>Wait… Am I saying that it is a good idea to share your account with your pair? No, don’t get me wrong. We can do a couple of things to prevent this:</p><p>First, it is a good idea to create a local account only for your pairs. For example i&#39;ve created an account called <strong><em>pair</em></strong> in my computer. Also it is a good idea to create a <strong><em>tmux</em></strong> group as we will see later. Add both your user and pair user to that group.</p><p>Also instead of sharing the password for that account I’m using certificates to handle who has access. That way it is super easy to revoke the access once it is no longer necessary. There is one awesome gem called <a href="https://github.com/chrishunt/github-auth">github-auth</a> that simplifies a lot the process. I can make something like</p><pre>sudo su - pair<br>gh-auth add --users=&lt;my pair’s Github user&gt;</pre><p>And it will allow my pair to connect to my laptop without having to deal with passwords or stuff like that. Also the pair user has access to tmux so he can connect to my session and finally he can’t access to anything else in my computer.</p><p>Also I can revoke access as simply as doing</p><pre>sudo su — pair<br>gh-auth remove --users=&lt;my pair’s Github user&gt;</pre><p>How does this work? Well, this works because all our Github public keys are public. You can access yours through a url like:</p><pre><a href="https://github.com/rafadc.keys">https://github.com/&lt;your username&gt;.keys</a></pre><p>Then this is using ssh’s authorized keys to allow a user to login as pair user without having to type his password.</p><p>Let’s test this. I’m login with pair user and let’s see if I can connect to one of my tmux sessions:</p><pre>tmux ls<br>failed to connect to server: No such file or directory</pre><p>What? Isn&#39;t this enough? Well… no. Unfortunately we need to add an extra small step. When we start a tmux session we need to provide a socket so it is shared between different users. Let’s start our pairing session with that new parameter:</p><pre>tmux -S /tmp/tmux_pair_socket new-session -s pair_session</pre><p>And we have created a new session and also exposing a socket so the other user can connect. The bad thing with this approach is that the socket will have wrong permissions for sure. That’s when the tmux group comes handy. I’ve created a /var/tmux/ folder and gave it 770 permission and changed the group to tmux. This way we can hold the socket there and change the property of the socket to tmux group.</p><pre>mkdir /var/tmux<br>sudo chmod 770 /var/tmux<br>sudo chgrp tmux /var/tmux</pre><p>Then let’s create the socket there.</p><pre>tmux -S /var/tmux/pair_socket new-session -s pair_session</pre><p>And we will be able to see it from pair user.</p><pre>$ tmux -S /var/tmux/pair_socket ls<br>pair_session: 1 windows (created Sat Jul 11 11:40:08 2015) [78x30] (attached)</pre><p>And attach to it with</p><pre>tmux -S /var/tmux/pair_socket attach -t pair_session</pre><p>So. After all this config I only need to ask my partner to do:</p><pre>ssh pair@&lt;my IP&gt;<br>tmux -S /var/tmux/pair_socket attach -t pair_session</pre><p>And we will be sharing the terminal session with a super fast latency.</p><h3>Easing things a little bit</h3><p>Anyway still the user I’m pairing with needs to know the location of the socket. Let’s make the things a little bit easy for him.</p><p>We will make a small addition to <em>/etc/sshd_config</em> file so the pair does not need to remember anything.</p><pre>Match User pair<br>  ForceCommand /usr/local/bin/tmux -S /var/tmux/pair_socket attach -t pair_session</pre><p>Then if some pair tries to login into my computer and there is no pairing session prepared it will only output an error and if there is it will directly connect to it. Piece of cake!</p><p>Also to start a new pairing session I’ve added an alias to my .zshrc</p><pre>alias pair_tmux=’tmux -S /var/tmux/pair_socket new-session -s pair_session’</pre><p>With all this I only have to type in a terminal:</p><pre>pair_tmux</pre><p>and my pair just has to</p><pre>ssh pair@&lt;my ip&gt;</pre><p>And if the credentials are correct we just need to start coding!</p><p>Also I have the following alias to add permissions</p><pre>alias pair_adduser=’sudo -u pair -i gh-auth add — users ‘<br>alias pair_removeuser=’sudo -u pair -i gh-auth remove — users ‘</pre><p>This way I don’t need to switch user to give permission to somebody to the pairing environment.</p><h3>Firewalls</h3><p>Let’s say that you want to host a session and you are behind a firewall. If you don&#39;t want to change your firewall rules and you have a public host you can as a last resort try to do a reverse tunnel.</p><p>If you don’t have your own host you can try using <a href="https://ngrok.com/">ngrok</a>. It creates a reverse tunnel for you so your pair can connect to it. We can just do</p><pre>ngrok tcp 22</pre><p>And we will have a tunnel open that will be available to your pair through the URL that appears in the screen. For example in the following scenario</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfyjZP8ofrQICVbMZebnOw.png" /></figure><p>Our pair will have to connect using the following command</p><pre>ssh <a href="/service/mailto:pair@0.tcp.ngrok.io">pair@0.tcp.ngrok.io</a> -p 54147</pre><p>And that is it!</p><p>Just as a piece of advice avoid the homebrew version and download from their website. Ngrok client is no longer open sourced and homebrew will not be up to date.</p><p>Ngrok will also be free as long as only one client connects to your TCP socket. If you need more that one person their pricing is really reasonable.</p><h3>Conclusion</h3><p>It takes a little bit of work to set up a nice setup to pair using tmux but it is worth the effort. In the works case scenario I only need to</p><pre>pair_tmux<br>ngrok tcp 22</pre><p>And share a URL for may pair to connect. Piece of cake.</p><p>With this and a hangout I can pair with only a tiny little bit of lag and both users have control of the editor.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=561e0682d996" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-joy-of-coding/pairing-over-tmux-561e0682d996">Pairing over Tmux</a> was originally published in <a href="https://medium.com/the-joy-of-coding">The joy of programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>