<?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 Upendar Gareri on Medium]]></title>
        <description><![CDATA[Stories by Upendar Gareri on Medium]]></description>
        <link>https://medium.com/@ThisIsUpen?source=rss-6c967272850f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tiCfJe-CH2-IVmjeznaP8Q.jpeg</url>
            <title>Stories by Upendar Gareri on Medium</title>
            <link>https://medium.com/@ThisIsUpen?source=rss-6c967272850f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:47:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ThisIsUpen/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[Multiple git accounts on same machine]]></title>
            <link>https://medium.com/@ThisIsUpen/multiple-git-accounts-on-same-machine-f4df96054c89?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4df96054c89</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[configuration]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Thu, 05 May 2022 15:49:03 GMT</pubDate>
            <atom:updated>2022-06-30T10:09:03.165Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kyW8Vjk7SDUzKR-u" /><figcaption>Photo by <a href="https://unsplash.com/@praveentcom?utm_source=medium&amp;utm_medium=referral">Praveen Thirumurugan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>Note: I am using Mac machine for this demo</blockquote><p>I’ll use two git accounts for this demo. Gitlab as the personal account and Github as work account.</p><h3>1. Create SSH keys</h3><pre>$ ssh-keygen -t rsa -b 4096 -C “john.doe@company.com” -f “id_rsa_work”</pre><pre>$ ssh-keygen -t rsa -b 4096 -C “john.doe@gmail.com” -f “id_rsa_personal”</pre><h3>2. Add public SSH keys to Github and Gitlab account</h3><pre>$ pbcopy &lt; ~/.ssh/id_rsa_personal.pub  # to gitlab</pre><p><strong>Gitlab</strong>: Preference -&gt; SSH keys</p><pre>$ pbcopy &lt; ~/.ssh/id_rsa_work.pub  # to github</pre><p><strong>Github</strong>: Settings -&gt; SSH and GPG keys -&gt; New SSH key</p><h3>3. Add private SSH keys to ssh agent</h3><pre>$ ssh-add ~/.ssh/id_rsa_work<br>$ ssh-add ~/.ssh/id_rsa_personal</pre><h3>4. Create config file to manage the keys</h3><pre>$ cd ~/.ssh/<br>$ (umask 077; touch ~/.ssh/config)  // creates file if not exists<br>$ code config  // open in VS code, or use any editor</pre><p>Content:</p><pre># Work account<br>Host github.com-work<br>HostName github.com<br>User git<br>IdentityFile ~/.ssh/id_rsa_work</pre><pre># Personal account<br>Host gitlab.com-personal<br>HostName gitlab.com<br>User git<br>IdentityFile ~/.ssh/id_rsa_personal</pre><h3>5. .gitconfig file for different emails</h3><blockquote>For each commit git needs the author and email id. With gitconfig you can separate the email ids using “includeIf” condition</blockquote><pre>$ cd ~<br>$ code ~/.gitconfig</pre><p>Content:</p><pre>[init]<br>defaultBranch = main</pre><pre>[user]<br>name = John Doe<br>email = john.doe@company.com</pre><pre>[includeIf &quot;gitdir:~/personal/&quot;]<br>path = ~/personal/.gitconfig</pre><p>Make sure that you have a directory ~/personal for all your personal projects else change the configuration as per your preference.</p><p>Create the personal git config:</p><pre>$ code ~/personal/.gitconfig</pre><p>Content:</p><pre>[user]<br>    email = john.doe@gmail.com</pre><h3>6. Adjust remote URL for existing repositories</h3><p>List remote of the repository using</p><pre>git remote -v</pre><p>Ensure the string between <strong>@</strong> and <strong>:</strong> matches the “<strong>Host”</strong> we have given in the SSH config</p><pre>git remote set-url origin <a href="/service/mailto:git@github.com">git@github.com</a>-work:&lt;github_username&gt;/test_repo.git</pre><p>Similarly for new repos make sure to change the string between @ and : to the defined “Host” from config file.</p><blockquote><strong>Update</strong>: For work related repos, it is better to <strong>not</strong> put “-work” in SSH config as the work related repos might use submodules/references to other repos (as git URL) and that would lead to fetch error because of remote URL change.</blockquote><p>That’s it! Hope that helps :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4df96054c89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Swap tilde (~) and section sign (§) on Mac keyboard]]></title>
            <link>https://medium.com/@ThisIsUpen/swap-tilde-and-section-sign-on-mac-keyboard-b0636691b633?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0636691b633</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[swap]]></category>
            <category><![CDATA[keyboard]]></category>
            <category><![CDATA[tilde]]></category>
            <category><![CDATA[keyboard-layout]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Thu, 10 Feb 2022 21:35:24 GMT</pubDate>
            <atom:updated>2022-08-03T20:59:08.059Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LHHMQoqX1LD6kTfG" /><figcaption>Photo by <a href="https://unsplash.com/@kamiseba?utm_source=medium&amp;utm_medium=referral">Sebastian Banasiewcz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If your keyboard uses “section sign(§)” as a default state and you want to swap it with “tilde(~)” then you can follow the below approach.</p><ol><li><strong>Temporary fix — until the next restart</strong></li></ol><p>Open terminal and type -</p><pre>hidutil property --set &#39;{&quot;UserKeyMapping&quot;:[{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000035,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000064},{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000064,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000035}]}&#39;</pre><p>2. <strong>Do you want the change to be persistent on every restart?</strong></p><p><strong>2.1 Create an executable file in your home directory </strong><strong>~/.tilde-switch</strong></p><pre>cat &lt;&lt; &#39;EOF&#39; &gt; ~/.tilde-switch &amp;&amp; chmod +x ~/.tilde-switch<br>hidutil property --set &#39;{&quot;UserKeyMapping&quot;:[{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000035,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000064},{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000064,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000035}]}&#39;<br>EOF</pre><p><strong>2.2 Create a system task</strong></p><pre>sudo /usr/bin/env bash -c &quot;cat &gt; /Library/LaunchDaemons/org.custom.tilde-switch.plist&quot; &lt;&lt; EOF<br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br>  &lt;dict&gt;<br>    &lt;key&gt;Label&lt;/key&gt;<br>    &lt;string&gt;org.custom.tilde-switch&lt;/string&gt;<br>    &lt;key&gt;Program&lt;/key&gt;<br>    &lt;string&gt;${HOME}/.tilde-switch&lt;/string&gt;<br>    &lt;key&gt;RunAtLoad&lt;/key&gt;<br>    &lt;true/&gt;<br>    &lt;key&gt;KeepAlive&lt;/key&gt;<br>    &lt;false/&gt;<br>  &lt;/dict&gt;<br>&lt;/plist&gt;<br>EOF</pre><p>The above command basically runs the file ~/.tilde-switch on every start</p><p><strong>2.3 Activate or load the task</strong></p><pre>sudo launchctl load -w -- /Library/LaunchDaemons/org.custom.tilde-switch.plist</pre><p><strong>3. To undo only “step 1&quot; i.e if you have not activated it as system task (step 2)</strong></p><pre>hidutil property --set &#39;{&quot;UserKeyMapping&quot;:[{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000035,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000035},{&quot;HIDKeyboardModifierMappingSrc&quot;:0x700000064,&quot;HIDKeyboardModifierMappingDst&quot;:0x700000064}]}&#39;</pre><p><strong>4. To undo the system task creation step (step 2)</strong></p><pre>sudo launchctl unload -w -- /Library/LaunchDaemons/org.custom.tilde-switch.plist; sudo rm -f -- /Library/LaunchDaemons/org.custom.tilde-switch.plist ~/.tilde-switch</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0636691b633" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keyboard shortcut to jump between words in iTerm2]]></title>
            <link>https://medium.com/@ThisIsUpen/how-to-jump-between-words-in-iterm2-3c22eb5a25ef?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c22eb5a25ef</guid>
            <category><![CDATA[zsh]]></category>
            <category><![CDATA[autocomplete]]></category>
            <category><![CDATA[iterm2]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[shortcut-keys]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 16:27:14 GMT</pubDate>
            <atom:updated>2022-02-02T16:28:20.527Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KCmnTFA_WFjIlNwP" /><figcaption>Photo by <a href="https://unsplash.com/@johnpet?utm_source=medium&amp;utm_medium=referral">John Petalcurin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I am using zsh with auto suggestion plugin and in my new Mac setup I found that I was only able to complete the entire command using “-&gt;” arrow key. The feature to only select part of the command or jump only to next/previous word in the command was not set up by default.</p><p>A simple trick to solve this is mentioned below -</p><blockquote><strong>1. Click on iTerm2 and open “Preferences”</strong></blockquote><blockquote><strong>2. Click on “Profiles”</strong></blockquote><blockquote><strong>3. Select your profile from the left (in my case “Default”)</strong></blockquote><blockquote><strong>4. Click on “Keys” tab</strong></blockquote><blockquote><strong>5. Click “Key Mappings” tab</strong></blockquote><blockquote><strong>6. Click the “Presets” dropdown and select “Natural Text Editing”</strong></blockquote><p>After this pressing the “option/alt” and “-&gt;” jumps to the next word of auto-suggestion.</p><p>Hope this helps. Cheers!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c22eb5a25ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python setup on macOS]]></title>
            <link>https://medium.com/@ThisIsUpen/python-setup-on-macos-59b2329bd920?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/59b2329bd920</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[pipenv]]></category>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[pyenv]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Sun, 14 Nov 2021 13:30:48 GMT</pubDate>
            <atom:updated>2023-08-03T16:22:56.994Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>Tools Used</strong>: Homebrew, Pyenv and Pipenv</blockquote><p>On a Mac, the operating system needs the version of Python kept at <strong><em>/usr/bin/python*</em></strong>. You cannot do much to this version — and don’t try or you’ll mess up your Mac.</p><p>You can already use python3 as it is system installed but if you need to manage different versions of Python for various different projects then this guide can help you.</p><h3>1. Install homebrew</h3><pre><strong>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;</strong></pre><h3>2. Install Pyenv</h3><p>Pyenv is a python version manager.</p><pre><strong>brew install pyenv</strong></pre><p><strong>Install Python using pyenv</strong></p><pre><strong>pyenv install 3.10.0</strong></pre><p>The above command will install python 3.10.0.</p><p><strong>Setup PATH for macOS</strong></p><p>Edit your ~/.bash_profile and/or ~/.zshenv file so that the PATH comes before “/usr/local/bin” and “/usr/bin” where others install programs:</p><p><em>For .zshrc -</em></p><pre><strong>echo &#39;export PYENV_ROOT=$(pyenv root)&quot;&#39; &gt;&gt; ~/.zshrc<br>echo &#39;export PATH=&quot;$PYENV_ROOT/shims:$PATH&quot;&#39; &gt;&gt; ~/.zshrc</strong></pre><p><em>Replace with .bashrc or so for others</em></p><p>Add pyenv init to your terminal</p><pre><strong>echo -e &#39;if command -v pyenv 1&gt;/dev/null 2&gt;&amp;1; then\n  eval &quot;$(pyenv init -)&quot;\nfi&#39; &gt;&gt; ~/.zshrc</strong></pre><p>Restart your terminal</p><pre><strong>exec &quot;$SHELL&quot;</strong></pre><p><strong>Confirmation</strong></p><pre><strong>which python</strong></pre><p>should return <em>‘ /Users/&lt;name&gt;/.pyenv/shims/python’</em></p><blockquote>To know more about shims, read THEORY below</blockquote><p>To check all python versions installed using pyenv</p><pre><strong>pyenv versions</strong>  # to check all python versions installed using pyenv</pre><h4>SET PYTHON VERSION</h4><pre><strong>pyenv global 3.10.0  # </strong>set specific version as the default</pre><p>If a particular project needs a different python version, then install that version first (if not installed already), navigate to the project folder, and set that version as local to that folder. Example -</p><pre><strong>pyenv install 3.6.5</strong></pre><pre><strong>cd &lt;path to project folder&gt;</strong></pre><pre><strong>pyenv local 3.6.5</strong></pre><p>This way, a specific project will use version 3.6.5, and all other projects by default will use the 3.10.0 version.</p><h4>ORDER OF PATH OVERRIDE</h4><p>When a shim is executed, it calls pyenv which loads Python release based on the following order:</p><blockquote>1. $PYENV_VERSION environment variable</blockquote><blockquote>2. pyenv local x.y.z</blockquote><blockquote>3. pyenv global x.y.z</blockquote><p>This means the PYENV_VERSION environment variable overrides all other specifications.</p><h4>TROUBLESHOOT</h4><p>If `python3 -V` doesn’t show 3.10.0 then it might be related to PATH</p><p>From stackoverflow:</p><p>“Check your PATH. Somehow I have .pyenv/bin, when it should be .pyenv/shims. Fix the path with</p><p>export PATH=”$HOME/.pyenv/shims:$PATH”</p><p>(and add to zshrc etc)”</p><h3>3. Install Pipenv</h3><pre><strong>brew install pipenv</strong></pre><p>Navigate to the project folder and run</p><pre><strong>pipenv shell</strong></pre><p>This will create virtual environment with the same name as the folder name (plus some hash).</p><p>To install python packages from requirements.txt or Pipfile already in the project folder</p><pre><strong>pipenv install</strong></pre><p>To install additonal packages</p><pre><strong>pipenv install &lt;package_name&gt;</strong></pre><blockquote><strong>Pipenv Cheatsheet</strong>: <a href="https://upengareri.github.io/pipenv_cheatsheet/">https://upengareri.github.io/pipenv_cheatsheet/</a></blockquote><h4>THEORY</h4><p>To get detailed understanding of how PATH works in macOS follow the below link — <a href="https://github.com/pyenv/pyenv">https://github.com/pyenv/pyenv</a></p><blockquote><em>When you run a command like </em><em>python or </em><em>pip, your operating system searches through a list of directories to find an executable file with that name. This list of directories lives in an environment variable called </em><em>PATH, with each directory in the list separated by a colon:</em></blockquote><pre>/usr/local/bin:/usr/bin:/bin</pre><blockquote><em>Directories in </em><em>PATH are searched from left to right, so a matching executable in a directory at the beginning of the list takes precedence over another one at the end. In this example, the </em><em>/usr/local/bindirectory will be searched first, then </em><em>/usr/bin, then </em><em>/bin.</em></blockquote><blockquote><em>pyenv works by inserting a directory of </em>shims<em> at the front of your </em><em>PATH:</em></blockquote><pre>$(pyenv root)/shims:/usr/local/bin:/usr/bin:/bin</pre><blockquote><em>Through a process called </em>rehashing<em>, pyenv maintains shims in that directory to match every Python command across every installed version of Python — </em><em>python, </em><em>pip, and so on.</em></blockquote><blockquote><em>Shims are lightweight executables that simply pass your command along to pyenv.</em></blockquote><p>That’s it :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59b2329bd920" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shorten zsh prompt path]]></title>
            <link>https://medium.com/@ThisIsUpen/shorten-zsh-prompt-path-f115a771fc0e?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f115a771fc0e</guid>
            <category><![CDATA[zsh]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[oh-my-zsh]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Tue, 03 Aug 2021 13:47:20 GMT</pubDate>
            <atom:updated>2021-11-14T10:12:50.657Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re using zsh and oh-my-zsh package manager then follow the below steps to shorten the prompt path</p><p>| Note: Tried and tested in Ubuntu</p><p>Open your <strong>zshrc</strong> file</p><pre>vi ~/.zshrc</pre><p>Paste the below function</p><pre># override functions of oh-my-zsh<br># don&#39;t show more than 2 directories in the path<br>prompt_dir() {<br>  prompt_segment blue $CURRENT_FG &#39;%2~&#39;<br>}</pre><blockquote>Basically the default value is ‘<strong>%~</strong>’ and we have added <strong>2</strong> because we want to show only the current directory and its parent directory.</blockquote><h3><strong>BONUS:</strong></h3><h4>To hide user@machine from zsh prompt</h4><p>Add below code to .zshrc file</p><pre># don&#39;t show user@machine<br>prompt_context() {}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f115a771fc0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Last Goodbye]]></title>
            <link>https://medium.com/@ThisIsUpen/the-last-goodbye-822cdaee1f98?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/822cdaee1f98</guid>
            <category><![CDATA[autumn]]></category>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[storytelling]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Sun, 15 Oct 2017 14:37:10 GMT</pubDate>
            <atom:updated>2017-10-15T14:37:10.490Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sF99bXeEyeGgjwt8w_PbsA.jpeg" /><figcaption>The Fall</figcaption></figure><blockquote>Its playfulness gone;</blockquote><blockquote>a sudden breeze</blockquote><blockquote>and the silent leaf falls.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=822cdaee1f98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Somewhere]]></title>
            <link>https://medium.com/@ThisIsUpen/somewhere-b5aaab6e490d?source=rss-6c967272850f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5aaab6e490d</guid>
            <category><![CDATA[life]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[poetry]]></category>
            <category><![CDATA[poem]]></category>
            <dc:creator><![CDATA[Upendar Gareri]]></dc:creator>
            <pubDate>Tue, 23 May 2017 15:21:33 GMT</pubDate>
            <atom:updated>2017-05-23T15:33:46.542Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CDF6cu11j_MzRPq1G6Wc-w.jpeg" /></figure><p>Search for a place,</p><p>far far away.</p><p>Free from the crowd</p><p>and hassles of life.</p><p>To a lovely place,</p><p>where no logic resides;</p><p>Jump and splash,</p><p>gaze and relax,</p><p>sit by the fire,</p><p>in an open air</p><p>with a lovely soul</p><p>right by your side.</p><p>A little drink</p><p>and barbecue around</p><p>with our favourite music</p><p>we dance around.</p><p>Waiting for that moment</p><p>waiting for that time</p><p>To a lovely place,</p><p>where no logic resides.</p><p><em>If you liked this, click the💚 below so other people will see this here on Medium.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5aaab6e490d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>