<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mohammed Shammout</title>
    <description>The latest articles on DEV Community by Mohammed Shammout (@linkinmedo).</description>
    <link>https://dev.to/linkinmedo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F101253%2F8eb38314-9978-41a2-8430-2a9838319c46.jpeg</url>
      <title>DEV Community: Mohammed Shammout</title>
      <link>https://dev.to/linkinmedo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/linkinmedo"/>
    <language>en</language>
    <item>
      <title>The journey to dotfiles ZEN</title>
      <dc:creator>Mohammed Shammout</dc:creator>
      <pubDate>Thu, 12 Nov 2020 11:05:17 +0000</pubDate>
      <link>https://dev.to/linkinmedo/the-journey-to-dotfiles-zen-4mna</link>
      <guid>https://dev.to/linkinmedo/the-journey-to-dotfiles-zen-4mna</guid>
      <description>&lt;h2&gt;
  
  
  The problem with dotfiles
&lt;/h2&gt;

&lt;p&gt;As a new developer you will learn that using the cli will mean that you have to deal with what's called dotfiles which are usually used as configuration files.&lt;/p&gt;

&lt;p&gt;The name dotfiles come from the fact that these files names start with a dot eg: .zshrc which makes them hidden by default in file explorers.&lt;/p&gt;

&lt;p&gt;It's simple enough at first but problems starts to rise when you are forced to use multiple devices and want to keep your dotfiles synced between them.&lt;/p&gt;

&lt;p&gt;This post is here to help you with keeping your dotfiles in sync and reach your dotfiles zen.&lt;/p&gt;

&lt;h2&gt;
  
  
  The journey begins
&lt;/h2&gt;

&lt;p&gt;It all starts with a git repository with all your dotfiles symlinked to it.&lt;/p&gt;

&lt;p&gt;What is symlinking you might ask, welp you can think of it as shortcut of sort to your file and that's the extent of knowledge you need to have to use it.&lt;/p&gt;

&lt;p&gt;Now lets make a new directory and cd into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir dotfiles

$ cd dotfiles
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then let's choose the dotfiles we want to symlink, for this blog we are going to use .bash_profile as an example.&lt;/p&gt;

&lt;p&gt;It's usually located at your home directory, so to symlink it we use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ln -sf ~/.bash_profile ./.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create .bash_profile file in our directory and link it to the one in the home directory so that both of them will always have the same data.&lt;/p&gt;

&lt;p&gt;You should do this to all the files that you want to be easily synced between your devices.&lt;/p&gt;

&lt;h2&gt;
  
  
  The linking automation
&lt;/h2&gt;

&lt;p&gt;Now that we have all our files linked we want an easy way to link them on other devices, and this is where writing a simple shell script comes into play.&lt;/p&gt;

&lt;p&gt;A simple shell script is a .sh file with a sequence of shell commend written in it, yup it's that simple.&lt;/p&gt;

&lt;p&gt;So let's make our install.sh script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ touch install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open it with your favorite text editor and write the linking command in it but reversed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -sf ~/dotfiles/.bash_profile ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You notice that I wrote the full path to our directory in the linking command, this save you a lot of permission headache but also means that you'll have to be careful and clone your repository to the path you've specified in the install.sh &lt;/p&gt;

&lt;h2&gt;
  
  
  The remote repository
&lt;/h2&gt;

&lt;p&gt;It starts with initializing a git repository locally, assuming you have git installed you just have to type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;while you are in the dotfiles directory.&lt;/p&gt;

&lt;p&gt;Next you have to go to your favorite git repository hosting site (in our case github.com) and create a new repository called dotfiles.&lt;/p&gt;

&lt;p&gt;When you are done creating the remote repository, the next step is to link and push your local repository to it which is as simple as writing two lines in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git remote add origin git@github.com:yourusername/dotfiles.git
$ git push -u origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's pretty much it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using your dotfiles repository
&lt;/h2&gt;

&lt;p&gt;To use your newly created dotfiles repository on a new device, you just have to clone it to your new device in the same location you had it on you original device.&lt;/p&gt;

&lt;p&gt;In our case it's the home directory, so while in your home directory run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone git@github.com:yourusername/dotfiles.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After you clone the repository, you should cd into it and run the install.sh:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd dotfiles
$ ./install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and voila you have your local dotfiles synced with your repository dotfiles.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making changes
&lt;/h2&gt;

&lt;p&gt;Let's say you made some changes to your dotfiles and want to sync them, all you have to do is commit your new changes and push them to your remote repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/dotfiles
$ git add .
$ git commit -m 'your message'
$ git push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then on the other devices you should pull the changes and run the install.sh:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git pull
$ ./install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have to do this whenever you make changes to your dotfiles, and they will be the same between all your devices.&lt;/p&gt;

&lt;p&gt;Please note that we used .bash_profile in this tutorial but you can use this method with as many files you want you just add the symlink the files and add them to your install.sh.&lt;/p&gt;

</description>
      <category>shell</category>
      <category>cmd</category>
      <category>dotfiles</category>
      <category>cli</category>
    </item>
    <item>
      <title>Steam Roulette</title>
      <dc:creator>Mohammed Shammout</dc:creator>
      <pubDate>Sun, 09 Dec 2018 00:18:07 +0000</pubDate>
      <link>https://dev.to/linkinmedo/steam-roulette-1h7i</link>
      <guid>https://dev.to/linkinmedo/steam-roulette-1h7i</guid>
      <description>

&lt;p&gt;So I've created this small app which select a random game from your steam library for you to play, then I started to expand on the idea and wanted it to work offline.&lt;/p&gt;

&lt;p&gt;It's not completely done but thought I should share it to get feedback on how to make it better and what should be my approach to make it work 100% offline.&lt;/p&gt;

&lt;p&gt;here is the repo: &lt;a href="https://github.com/linkinmedo/steam-roulette"&gt;https://github.com/linkinmedo/steam-roulette&lt;/a&gt; &lt;br&gt;
and the live version: &lt;a href="http://steam.mohsh.com"&gt;http://steam.mohsh.com&lt;/a&gt;&lt;/p&gt;


</description>
      <category>react</category>
      <category>javascript</category>
      <category>steam</category>
      <category>serviceworkers</category>
    </item>
    <item>
      <title>Websocket Counter Button</title>
      <dc:creator>Mohammed Shammout</dc:creator>
      <pubDate>Fri, 28 Sep 2018 17:59:09 +0000</pubDate>
      <link>https://dev.to/linkinmedo/websocket-counter-button-3nlf</link>
      <guid>https://dev.to/linkinmedo/websocket-counter-button-3nlf</guid>
      <description>&lt;p&gt;So I have created a button that increment a number when clicked 🎉&lt;/p&gt;

&lt;p&gt;Yup, that's about it 😂&lt;/p&gt;

&lt;p&gt;Well it's kinda more complicated than this, what I actually made is a button that increment a number when clicked but that number is global so that anybody clicking the button will add to the same number.&lt;/p&gt;

&lt;p&gt;It's just a side project that I built to try some technologies that I've wanted to try for sometime now like websocket and vuejs.&lt;/p&gt;

&lt;p&gt;I also added some stats to the mix to make the whole thing a little more interesting.&lt;/p&gt;

&lt;p&gt;You can start clicking using the following link:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://button.mohsh.com"&gt;WS Button&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think there is room for improvement in my implementation so if you have the time please check it on my github and give me feedback on ways to improve it.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/linkinmedo"&gt;
        linkinmedo
      &lt;/a&gt; / &lt;a href="https://github.com/linkinmedo/ws-counter"&gt;
        ws-counter
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Websocket Counter Button ⚡️
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Websocket Counter Button&lt;/h1&gt;
&lt;p&gt;This is an over complicated counter button that is build using NodeJS, Websocket and VueJS.&lt;/p&gt;
&lt;p&gt;Live version of this button can be found &lt;a href="https://button.mohsh.com" rel="nofollow"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/linkinmedo/ws-counter"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;
 

&lt;p&gt;Thank you and have a nice day 😁&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>websocket</category>
      <category>node</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
