<?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: ShulyAvraham</title>
    <description>The latest articles on DEV Community by ShulyAvraham (@shulyavraham).</description>
    <link>https://dev.to/shulyavraham</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%2F978478%2F77f41aa8-edad-41ec-946c-a70159a45378.jpg</url>
      <title>DEV Community: ShulyAvraham</title>
      <link>https://dev.to/shulyavraham</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shulyavraham"/>
    <language>en</language>
    <item>
      <title>OSDC LESSON 8: Webhooks, git stash, tests coverage report</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 12 Mar 2023 15:30:50 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-lesson-8-11gi</link>
      <guid>https://dev.to/shulyavraham/osdc-lesson-8-11gi</guid>
      <description>&lt;h1&gt;
  
  
  GitHub
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Webhooks
&lt;/h2&gt;

&lt;p&gt;Found on the left bar on github website.&lt;/p&gt;

&lt;p&gt;Define an event (e.g. push) that triggers a call to a website that I created. The event will call the website and send a json file with information from github. Then this website will receive the json file from github and perform things e.g. git pull and then generate pages from the files...&lt;/p&gt;

&lt;h2&gt;
  
  
  git stash
&lt;/h2&gt;

&lt;p&gt;Take the local changes, keep them aside, and return to the latest committed version.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The changes were not lost.&lt;/p&gt;

&lt;p&gt;Now I can&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
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bring my changes back from stash to my working directory.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The stash is a stack that keeps several changes. To see all changes:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To see the most recent change in the stash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash show -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see a change in a specific stash in the stack&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash show 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove the most recent change from stash&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Remove a specific change from the stash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash drop 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stash pop might also cause a merge conflict which needs to be resolved. In that case, the change will not be removed from the stash.&lt;/p&gt;

&lt;h2&gt;
  
  
  Docker playground
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/szabgab/playground"&gt;https://github.com/szabgab/playground&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can use &lt;a class="mentioned-user" href="https://dev.to/szabgab"&gt;@szabgab&lt;/a&gt; docker as playground&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt szabgab/playground:latest bash'
dr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run an image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run imagename:version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the image does not exist locally it will be downbloaded first from docker hub and then run.&lt;/p&gt;

&lt;p&gt;Build a docker from a Docker file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t username/dockername:version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Run a project from git inside docker
&lt;/h2&gt;

&lt;p&gt;Use &lt;a class="mentioned-user" href="https://dev.to/szabgab"&gt;@szabgab&lt;/a&gt; playground docker&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use some other docker image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run -it --rm --workdir /opt -v$(pwd):/opt python:3.11 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To explore the project we can look at the github folder, and we might find the ci tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  make and Makefile
&lt;/h2&gt;

&lt;p&gt;Run shell commands with dependencies&lt;br&gt;
Instead of README.md - the Makefile contains all the commands to be run, and executing &lt;code&gt;make&lt;/code&gt; will run these commands.&lt;br&gt;
&lt;code&gt;make&lt;/code&gt; is the command and &lt;code&gt;Makefile&lt;/code&gt; is a file that contains commands. Each set of commands have some tag. So one might run the specific set of commands in a tag&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make sometag
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example for the Makefile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;init:
    pip install -r requirements.txt
ci:
    pytest tests

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So to run the ci&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make ci
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  tox
&lt;/h2&gt;

&lt;p&gt;a tool to run tests on several versions of python&lt;/p&gt;

&lt;h2&gt;
  
  
  Coverage report for tests
&lt;/h2&gt;

&lt;p&gt;First install&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install pytest pytest-random-order pytest-coverage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pytest -svv --random-order --cov-branch cov-report html cov-report  term cov somedir......
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;random-order&lt;/code&gt; runs functions on random order to make sure functions are not dependent on each other&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cov-report html&lt;/code&gt; will generate the report in html format&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cov-report term&lt;/code&gt; will send the report to the terminal&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cov-branch&lt;/code&gt; Branch coverage&lt;br&gt;
In case we have an if command in the code, or loop or something along these lines, it means that depending on the data transferred to the function the code inside the if or loop might be executed or not. So the cov-branch will report in case we have several "branches" in the code, and the coverage for all branches.&lt;/p&gt;

&lt;h2&gt;
  
  
  contribute to pydigger
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Look at the list of missing stuff. &lt;/li&gt;
&lt;li&gt;Pick a project.&lt;/li&gt;
&lt;li&gt;Go to the github of the project.&lt;/li&gt;
&lt;li&gt;make a change on the project's github (e.g. add the author to the setup.py file)&lt;/li&gt;
&lt;li&gt;Send a pull request&lt;/li&gt;
&lt;li&gt;Once the author of the project accepts the change and place it on pypi, pydigger will retrieve the change and be updated accordingly.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>osdc</category>
    </item>
    <item>
      <title>Lesson 7: Contribute to open source projects on GitHub</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 26 Feb 2023 14:59:56 +0000</pubDate>
      <link>https://dev.to/shulyavraham/lesson-7-contribute-to-open-source-projects-on-github-dockers-54pk</link>
      <guid>https://dev.to/shulyavraham/lesson-7-contribute-to-open-source-projects-on-github-dockers-54pk</guid>
      <description>&lt;h2&gt;
  
  
  Contribute to projects on GitHub
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Contribute to dev.to
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://dev.to/"&gt;dev.to&lt;/a&gt; Is an open source project&lt;/p&gt;

&lt;p&gt;We found an issue with auto save - so that when I write text, the system will automatically save it, or save changes but keep editing.&lt;/p&gt;

&lt;p&gt;Built on &lt;a href="https://www.forem.com/"&gt;Forem&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the &lt;a href="https://github.com/forem/forem"&gt;github link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;code&gt;Issues&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Before we open a new issue it is recommended to check if the issues was already addressed:&lt;/p&gt;

&lt;p&gt;Use the &lt;code&gt;Filters&lt;/code&gt; to search for the issue. Search for 'autosave'.&lt;/p&gt;

&lt;p&gt;Can also search &lt;code&gt;Pull requests&lt;/code&gt; or &lt;code&gt;Discussions&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Contribute to zarr-python
&lt;/h3&gt;

&lt;p&gt;(&lt;a href="https://github.com/zarr-developers/zarr-python"&gt;https://github.com/zarr-developers/zarr-python&lt;/a&gt;)&lt;/p&gt;

&lt;h4&gt;
  
  
  Advance pull-request locally
&lt;/h4&gt;

&lt;p&gt;E.g. I find that somebody sent a pull request with a solution to my problem, but it's not advancing.&lt;/p&gt;

&lt;p&gt;I can advance that pull request on my end:&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 &amp;lt;the project's github url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fetch the pull request by its number&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch origin pull/1357/head
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b b1357 FETCH-HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I'm in a branch that contains the pull request code change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FETCH_HEAD&lt;/strong&gt; is a special file inside the '.git' folder, that was created when I run &lt;code&gt;git fetch&lt;/code&gt; and it contains the SHA of the pull request.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat .git/FETCH_HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just like &lt;strong&gt;HEAD&lt;/strong&gt; is a file which points to where I am currently located locally (which SHA).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat .git/HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I will merge the pull request with the main branch into a new branch&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout main
git checkout -b szabgab
git merge b1357
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;HEAD&lt;/strong&gt; is a pointer to where I am currently in the git commits tree.&lt;/p&gt;

&lt;h1&gt;
  
  
  Git Conflicts
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge &amp;lt;some branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Might cause conflicts. To resolve the conflicts, first locate the conflicting files:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Edit the conflicting file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vim &amp;lt;file with conflict&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Search for '&amp;gt;&amp;gt;&amp;gt;' or '&amp;lt;&amp;lt;&amp;lt;' and edit the file to resolve the conflict.&lt;/p&gt;

&lt;p&gt;To cancel the merge that caused conflicts&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h1&gt;
  
  
  Docker for running the project
&lt;/h1&gt;

&lt;p&gt;An example for a docker image created by &lt;a class="mentioned-user" href="https://dev.to/szabgab"&gt;@szabgab&lt;/a&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/szabgab/mydocker"&gt;https://github.com/szabgab/mydocker&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t mydocker .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An alias to run the docker&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias dr='docker run -it --rm --workdir /opt -v$(pwd):/opt mydocker bash'
dr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Tests
&lt;/h1&gt;

&lt;p&gt;It is recommended to find out how to run tests locally. It is normally somewhere in the docs.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tests coverage report
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Codecov Report&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;During the tests run on GitHub or GitLab, the source code is being analyzed for which lines of code run as a result of the tests run, meaning those lines of code are being tested. A report is generated with the percentage of lines that are being tested (lines of code that run during the tests).&lt;/p&gt;

&lt;p&gt;It is recommended that the code coverage be closest to 100%.&lt;/p&gt;

&lt;p&gt;Some code may be deprecated, hence its not tested, so the code should be removed.&lt;/p&gt;

&lt;p&gt;Or, perhaps a new function was added without a test.&lt;/p&gt;

</description>
      <category>osdc</category>
    </item>
    <item>
      <title>OSDC Lesson 6: Dockers</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 12 Feb 2023 15:20:15 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-lesson-6-dockers-47a4</link>
      <guid>https://dev.to/shulyavraham/osdc-lesson-6-dockers-47a4</guid>
      <description>&lt;h1&gt;
  
  
  Exit code in tests
&lt;/h1&gt;

&lt;h2&gt;
  
  
  R tests
&lt;/h2&gt;

&lt;p&gt;Testthat is a library for tests in R&lt;/p&gt;

&lt;h3&gt;
  
  
  Exit code
&lt;/h3&gt;

&lt;p&gt;Every program that runs on the command line sends an exit code after finishing.&lt;/p&gt;

&lt;p&gt;Show the exit code of the last run program on the command line&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Programs that finished successfully without errors return exit code 0.&lt;/p&gt;

&lt;p&gt;In languages like R, that have no &lt;code&gt;assert&lt;/code&gt; like python, when in tests, when I don't get the desired result, I will exit and send an exit code of anything but 0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exit(1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Docker
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;An encapsulation of a unified environment. &lt;/li&gt;
&lt;li&gt;Define a very specific environment.&lt;/li&gt;
&lt;li&gt;One can control the environment.&lt;/li&gt;
&lt;li&gt;Install a development environment relatively easily.&lt;/li&gt;
&lt;li&gt;Separates between my computer to where I run code (eg when I download software from the web). With Docker I can limit the files that the Docker can see, as I map specific folder to docker.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Run docker
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -it ubuntu:22.04 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--rm&lt;/code&gt; : remove the docker when finishes&lt;br&gt;
&lt;code&gt;--it&lt;/code&gt; : interactive&lt;br&gt;
&lt;code&gt;bash&lt;/code&gt; : run bash inside the docker&lt;br&gt;
&lt;code&gt;ubuntu&lt;/code&gt; : is the image&lt;br&gt;
&lt;code&gt;22.04&lt;/code&gt; : Is a tag, normally a version of the image and contains the year and month&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Unable to find image 'ubuntu:22.04' locally
22.04: Pulling from library/ubuntu
677076032cca: Pull complete
Digest: sha256:9a0bdde4188b896a372804be2384015e90e3f84906b750c1a53539b585fbbe7f
Status: Downloaded newer image for ubuntu:22.04
root@202e3c005b89:/#
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Docker pulled the specific image from the image repository as it didn't find it locally on my computer.&lt;/p&gt;

&lt;p&gt;Then I entered the docker into the &lt;code&gt;bash&lt;/code&gt; command line.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@202e3c005b89:/# apt-get update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Will bring me all the latest packages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@202e3c005b89:/# apt-get install python3
root@202e3c005b89:/# python3
&amp;gt;&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I can run python commands inside the docker...&lt;/p&gt;

&lt;p&gt;Everything I will run will happen inside the docker container's file system.&lt;/p&gt;

&lt;p&gt;Exit the image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@202e3c005b89:/# exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I exit the docker everything will be removed.The file system of the docker container will be deleted (unless I use the -v flag, explained next).&lt;/p&gt;

&lt;p&gt;There are many images in the &lt;a href="https://hub.docker.com"&gt;docker hub&lt;/a&gt;. I can select any image that suits my purpose.&lt;/p&gt;

&lt;p&gt;e.g. a python docker&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -it python:3.22
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;a href="https://pydigger.com"&gt;PyDigger&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;A site that crawls the web and collects information about python packages&lt;/p&gt;

&lt;p&gt;Look for an open source project to which you can contribute.&lt;/p&gt;

&lt;p&gt;Clone the project by copying the project's ssh URL.&lt;/p&gt;

&lt;p&gt;To see the source code inside the docker. I will ask the docker to map the project's folder to the docker's file system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; docker run -it --rm -v /mnt/c/Users/shuly.avraham/
work/LIMS_results_validation/:/opt python:3.11 bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project's folder on my computer was mapped to the &lt;code&gt;opt/&lt;/code&gt; folder within the docker.&lt;/p&gt;

&lt;p&gt;Now I can access the project's folder from within the docker container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@c6e9d5452e5f:/# ls opt/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can still edit the project's files using my preferred editor on the computer and it will take effect inside the docker container.&lt;/p&gt;

&lt;h3&gt;
  
  
  Run tests inside the docker
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pytest -svv tests/ 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;where &lt;code&gt;tests/&lt;/code&gt; is the folder in which I write my tests, which name start with &lt;code&gt;test_&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dockerfile
&lt;/h3&gt;

&lt;p&gt;Is a file where I write the configuration of my docker. I can start with a docker from docker hub and install more packages on it.&lt;/p&gt;

&lt;p&gt;If I'm in a container, after installing several packages, if I leave the docker, the installations will be lost. I can then create an image from the container&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker freeze
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Will create an image from within the container&lt;/p&gt;

&lt;p&gt;The disadvantage is that I don't know what I installed.&lt;/p&gt;

&lt;p&gt;A better way is to write a dockerfile with everything I want to install in my image. Let's call it &lt;code&gt;mydocker&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t mydocker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  An alias to easily run docker from &lt;code&gt;mydocker&lt;/code&gt; dockerfile
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias dr='docker run -it --rm --workdir /opt -v $(pwd):/opt mydocker bash'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GitHub Actions for Continous Integration
&lt;/h2&gt;

&lt;p&gt;After I added tests to a project and pushed them to git, I will configure the CI in GitHub to run the tests automatically in every push/pull_request (and other) attempt.&lt;/p&gt;

&lt;p&gt;GitHub actions is a service of GitHub where I can run commands on GitHub servers.&lt;/p&gt;

&lt;p&gt;I will have my own server/s in GitHub in which I can run commands, and the server/s will close after the commands finish.&lt;/p&gt;

&lt;p&gt;In order to configure it I will create a special directory and &lt;code&gt;ci.yml&lt;/code&gt; file inside my project's git root dir:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p .github/workflows
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside it I will create a file &lt;code&gt;ci.yml&lt;/code&gt; and edit it to configure the servers in which I will run my tests, and decide which OS and which languages versions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi .github/workflows/ci.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now &lt;code&gt;git push&lt;/code&gt; will run my tests on the servers and configurations I mentioned in  the &lt;code&gt;ci.yml&lt;/code&gt; file. &lt;/p&gt;

&lt;p&gt;I can go to the GitHub website of the project and check whether the tests succeeded or failed.&lt;/p&gt;

</description>
      <category>osdc</category>
    </item>
    <item>
      <title>OSDC Lesson 5:</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 05 Feb 2023 13:15:47 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-lesson-5-3o1b</link>
      <guid>https://dev.to/shulyavraham/osdc-lesson-5-3o1b</guid>
      <description>&lt;h1&gt;
  
  
  Work locally on a project not owned by me
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;p&gt;We see that there's an issue, the file &lt;em&gt;requirements.txt&lt;/em&gt; is missing.&lt;/p&gt;

&lt;p&gt;We can create it. Edit it to add the missing modules. In this case we're missing the &lt;code&gt;pyinstaller&lt;/code&gt; module. We'll add it to the file according to the instructions. &lt;/p&gt;

&lt;h2&gt;
  
  
  Create a new branch
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b &amp;lt;username&amp;gt;/&amp;lt;branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is advised to add my username in case someone else will use the same name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m'Add requirements file #2'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is advised to add the issue number to the commit message.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Git doesn't know where to push because the new branch is not mapped to remote, so the push needs to include the remote and the branch name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin &amp;lt;username&amp;gt;/&amp;lt;branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But it doesn't work because I don't have permissions on the project. Hence, I need to create my own fork of the project in my git.&lt;/p&gt;

&lt;p&gt;I'll go to the &lt;a href="https://github.com/OSDC-Code-Maven/osdc-site-generator" rel="noopener noreferrer"&gt;project's git&lt;/a&gt; and create a fork on my own git by clicking &lt;code&gt;fork&lt;/code&gt;-&amp;gt;&lt;code&gt;create a new fork&lt;/code&gt;-&amp;gt; I'll be the owner of the form -&amp;gt; &lt;code&gt;Create fork&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So now I have the project in my own user's git, on which I have write permissions.&lt;/p&gt;

&lt;p&gt;Now I need to add the remote of my fork&lt;/p&gt;

&lt;p&gt;I'll got to &lt;a href="https://github.com/ShulyAvraham/osdc-site-generator" rel="noopener noreferrer"&gt;my fork&lt;/a&gt; &lt;code&gt;code&lt;/code&gt;-&amp;gt;&lt;code&gt;ssh&lt;/code&gt;-&amp;gt;&lt;code&gt;Copy the URL&lt;/code&gt;&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 &amp;lt;any-name&amp;gt; &amp;lt;the-fork-url-in-github&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add fork git@github.com:ShulyAvraham/osdc-site-generator.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It adds the mapping to the &lt;code&gt;.git/config&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push --set-upstream fork &amp;lt;the-fork-url-in-github&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The flag &lt;code&gt;--set-upstream&lt;/code&gt; adds to the &lt;code&gt;.git/config&lt;/code&gt; lines that tell git to map this branch to the remote fork&lt;/p&gt;

&lt;p&gt;The changes were pushed to my fork. &lt;/p&gt;

&lt;p&gt;Going to the git website, &lt;/p&gt;

&lt;p&gt;Gabor doesn't know about my changes. In order for him to see it, I need to create a pull request.&lt;/p&gt;

&lt;p&gt;I go to the project on the GitHub site, and create a pull request&lt;/p&gt;

&lt;p&gt;Gabor, on his project now sees the &lt;code&gt;Pull request&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If Gabor is not happy with my changes, he can ask to fix it. Now every change that I will make to the branch and push out, will create a new pull request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull request
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Merge ...&lt;/code&gt;&lt;br&gt;
Select one of 3 options... &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Commit and merge&lt;/code&gt; - &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Squize and merge&lt;/code&gt; - will squeeze all Gabor's commits to one&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Rebase and merge&lt;/code&gt; - &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now I need to sync my local git with the remote main git that merged my changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout main
git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If I want to work on something else&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b &amp;lt;another-branch-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See all the branches&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote set-url origin --push &amp;lt;the remote git project not mine&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Merge and rebase
&lt;/h2&gt;

&lt;p&gt;Are related to the behavior of &lt;code&gt;git pull&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The result of the merge and rebase are the same, it's only the commits history that is different.&lt;/p&gt;

&lt;p&gt;I will make a local change on my local main branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add
git commit -m'add comment'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I will accept a pull request which someone sent me a pull, and the change reached the main branch.&lt;/p&gt;

&lt;p&gt;Now locally I have a change. I cannot push out, as what's in GitHub already changed. &lt;/p&gt;

&lt;p&gt;I need to locally merge the remote changes with my local changes.&lt;/p&gt;

&lt;p&gt;First I need to &lt;code&gt;git pull&lt;/code&gt; in order to merge changes on the remote with my local changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gitk --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Will show us graphically the changes&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Gets the changes from remote to my local copy, but will not merge with my local changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gitk --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How to mix the two?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merge&lt;/li&gt;
&lt;li&gt;Rebase&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pull can either merge or rebase.&lt;/p&gt;

&lt;p&gt;We can look at &lt;code&gt;.git/config&lt;/code&gt; to see the behavior.&lt;/p&gt;

&lt;p&gt;Merge&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[pull]
    rebase=false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Merge takes both changes, remote and local and merges them.&lt;/p&gt;

&lt;p&gt;Rebase&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[pull]
    rebase=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Normally git pull first does fetch and then merge.&lt;/p&gt;

&lt;p&gt;The rebase takes my local changes and places them after the changes on the remote git. Only for the commits history purpose.&lt;/p&gt;

</description>
      <category>announcement</category>
      <category>contributorswanted</category>
      <category>devto</category>
    </item>
    <item>
      <title>Testing for CI</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sat, 04 Feb 2023 15:15:54 +0000</pubDate>
      <link>https://dev.to/shulyavraham/testing-for-ci-2d73</link>
      <guid>https://dev.to/shulyavraham/testing-for-ci-2d73</guid>
      <description>&lt;h2&gt;
  
  
  Slides &amp;amp; Examples
&lt;/h2&gt;

&lt;p&gt;Check out &lt;a href="https://code-maven.com/slides/python/testing-demo" rel="noopener noreferrer"&gt;testing demo in Python&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/szabgab"&gt;@szabgab&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixture
&lt;/h2&gt;

&lt;p&gt;Is the testing environment prior to running the tests&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a test
&lt;/h2&gt;

&lt;p&gt;Create a new python script with a name starting with &lt;strong&gt;test_&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi test_myfunc.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The python script should include&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import mymodule # the mymodule file containing the myfunc function I want to test

def test_myfunc1():
    assert mymodule.myfunc("some input") == "some expected result"

def test_myfunc2():
    assert mymodule.myfunc("other input") == "other expected result"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I can add more &lt;strong&gt;test_&lt;/strong&gt; functions where each function is a test case.&lt;/p&gt;

&lt;p&gt;Run the test&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pytest test_myfunc.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will run all the &lt;strong&gt;test_&lt;/strong&gt; functions in &lt;strong&gt;test_myfunc.py&lt;/strong&gt; and show whether the tests passed or failed, based on the expected results, per test function.&lt;/p&gt;

&lt;p&gt;Tell &lt;code&gt;pytest&lt;/code&gt; to run the tests in random order to make sure that the tests are independent of each other&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pytest --rendom-order test_myfunc.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>OSDC Lesson 4: My project on GitHub</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Fri, 03 Feb 2023 19:35:36 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-lesson-4-51ho</link>
      <guid>https://dev.to/shulyavraham/osdc-lesson-4-51ho</guid>
      <description>&lt;h1&gt;
  
  
  Place my own project on GitHub
&lt;/h1&gt;

&lt;p&gt;Enter my project's dir&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd &amp;lt;my-proj&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the project to git and create the repository&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;a &lt;strong&gt;.git&lt;/strong&gt; directory will be created&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check the status of the git&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Add all files to the staging&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Remove a file which I don't want to track on git from staging (e.g. python's cache file)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rm --cached &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  git alias
&lt;/h3&gt;

&lt;p&gt;Add the following to the  &lt;code&gt;~/.gitconfig&lt;/code&gt; file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[alias]
    st = status
    co = checkout
    ci = commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  git ignore
&lt;/h3&gt;

&lt;p&gt;Add to the &lt;code&gt;.gitginore&lt;/code&gt; file a list of files or folders that you want git to ignore, e.g. &lt;code&gt;__pycache___&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vi .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the &lt;code&gt;.gitignore&lt;/code&gt; file to git&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the above referred to the local copy of my new git project. &lt;/p&gt;

&lt;h2&gt;
  
  
  Create a git project on GitHub
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to your &lt;a href="https://github.com/ShulyAvraham" rel="noopener noreferrer"&gt;user's GitHub page&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;On the top right click &lt;code&gt;+&lt;/code&gt;-&amp;gt;&lt;code&gt;New repository&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Provide &lt;code&gt;repository name&lt;/code&gt; - preferably with your project's root dir name (but not mandatory).&lt;/li&gt;
&lt;li&gt;Select Public or Private (I selected Public)&lt;/li&gt;
&lt;li&gt;Add a &lt;code&gt;README&lt;/code&gt; file or &lt;code&gt;.gitignore&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;if I started with creating the project in GitHub and then clone it - I will select to add &lt;code&gt;README&lt;/code&gt; and &lt;code&gt;gitignore&lt;/code&gt; files.&lt;/li&gt;
&lt;li&gt;In my case, where I first created the repository locally, using the &lt;code&gt;git init&lt;/code&gt; command and only then I careted the remote repo, I will choose not to add &lt;code&gt;README&lt;/code&gt; and &lt;code&gt;.gitignore&lt;/code&gt; files.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Click &lt;code&gt;Create repository&lt;/code&gt; (empty one)&lt;/li&gt;

&lt;li&gt;I will be provided instructions for connecting the remote with my local repositories.&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Connect the remote and local repositories
&lt;/h3&gt;

&lt;p&gt;Go back to the project root dir on the command line&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:ShulyAvraham/LIMS_results_validation.git
git remote -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will add the following lines to the &lt;code&gt;.git/config&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[remote "origin"]
        url = git@github.com:ShulyAvraham/LIMS_results_validation.git
        fetch = +refs/heads/*:refs/remotes/origin/*
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Map my branch to &lt;code&gt;main&lt;/code&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch -M main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Push repo to remote
&lt;/h3&gt;

&lt;p&gt;The name of the remote is &lt;code&gt;origin&lt;/code&gt; and the remote branch is &lt;code&gt;main&lt;/code&gt;. The -u configs git to map this connection for later pushes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push -u origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will add the following to the &lt;code&gt;.git/config&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[branch "main"]
        remote = origin
        merge = refs/heads/main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that the my local branch &lt;code&gt;main&lt;/code&gt; is mapped to the remote repo called &lt;code&gt;origin&lt;/code&gt; and is merged to the remote &lt;code&gt;main&lt;/code&gt; branch.&lt;/p&gt;

&lt;p&gt;We can have several remotes, with different remotes for push and pulls (fetch).&lt;/p&gt;

&lt;p&gt;Now I can see &lt;a href="https://github.com/ShulyAvraham/LIMS_results_validation" rel="noopener noreferrer"&gt;my source code on the project's GitHub page&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Correct the comment for my last commit &lt;strong&gt;before push&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;My first commit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m'some comment'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's look at the commit's sha&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now change the comment for the last commit&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m'a different comment' --amend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See the the sha was modified&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The next section will discuss &lt;a href="https://dev.to/shulyavraham/testing-for-ci-2d73"&gt;Testing for continuous integration&lt;/a&gt; &lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>tooling</category>
      <category>llm</category>
      <category>ai</category>
    </item>
    <item>
      <title>Install Git CLI</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Fri, 03 Feb 2023 19:28:04 +0000</pubDate>
      <link>https://dev.to/shulyavraham/install-git-cli-2lag</link>
      <guid>https://dev.to/shulyavraham/install-git-cli-2lag</guid>
      <description>&lt;h1&gt;
  
  
  Git CLI
&lt;/h1&gt;

&lt;p&gt;CLI is the command line for Git &lt;/p&gt;

&lt;h2&gt;
  
  
  Install GitHub CLI for Windows
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com" rel="noopener noreferrer"&gt;Download the Git client for Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Install the CLI

&lt;ul&gt;
&lt;li&gt;In &lt;strong&gt;Choose the default editor for used by git&lt;/strong&gt; select your editor of preference.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Override the default branch name for new repositories&lt;/strong&gt; and enter &lt;strong&gt;'main'&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Choose the default behavior for 'git pull'&lt;/strong&gt; select &lt;strong&gt;Rebase&lt;/strong&gt; &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;This will install a &lt;em&gt;bash&lt;/em&gt; command line prompt&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>discuss</category>
      <category>productivity</category>
    </item>
    <item>
      <title>SSH Key Pair</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 29 Jan 2023 13:53:35 +0000</pubDate>
      <link>https://dev.to/shulyavraham/ssh-key-pair-3ij8</link>
      <guid>https://dev.to/shulyavraham/ssh-key-pair-3ij8</guid>
      <description>&lt;h2&gt;
  
  
  SSH-Key
&lt;/h2&gt;

&lt;p&gt;Accessing a remote repository via SSH without the need to provide username and password every time I pull or push.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to your command line prompt (e.g. the GitHub CLI installed previously), and run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the same command for Windows, only with .exe extension.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Just hit Enter for each of  the questions asked...&lt;/li&gt;
&lt;li&gt;It will generate a &lt;code&gt;.ssh/&lt;/code&gt; directory in your home dir with &lt;strong&gt;key-pair&lt;/strong&gt; inside, in the form of 2 files:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;id_rsa&lt;/code&gt; - is the private key - which I always keep locally on my computer&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;id_rsa.pub&lt;/code&gt; is the public key - which I can publish somewhere on the internet
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls ~/.ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;View and copy the contents of &lt;code&gt;id-rsa.pub&lt;/code&gt; (depending on the OS you're using, use the appropriate editor or file viewer, here I will use Linux command &lt;code&gt;cat&lt;/code&gt; or &lt;code&gt;less&lt;/code&gt;. On Windows one might use Notepad).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat ~/.ssh/id-rsa.pub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Copy the file content &lt;/li&gt;
&lt;li&gt;Go back to your &lt;a href="https://github.com/ShulyAvraham" rel="noopener noreferrer"&gt;GitHub account page&lt;/a&gt;: Click &lt;code&gt;Setting&lt;/code&gt;-&amp;gt;&lt;code&gt;SSH and GPG keys&lt;/code&gt;-&amp;gt;&lt;code&gt;New SSH key&lt;/code&gt;-&amp;gt;paste the public key into the &lt;code&gt;Key&lt;/code&gt; text box, provide some &lt;code&gt;Title&lt;/code&gt;-&amp;gt; &lt;code&gt;Add SSH key&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Once this is done, I will not need to provide my username and password every time I communicate with the remote repo.&lt;/li&gt;
&lt;li&gt;This key pair might be copied over and used over several computers&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>express</category>
      <category>javascript</category>
      <category>security</category>
      <category>howto</category>
    </item>
    <item>
      <title>OSDC Lesson 3: GitHub CLI</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sat, 28 Jan 2023 16:42:48 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-lesson-3-github-cli-5ben</link>
      <guid>https://dev.to/shulyavraham/osdc-lesson-3-github-cli-5ben</guid>
      <description>&lt;h1&gt;
  
  
  Git CLI
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://dev.to/shulyavraham/install-git-cli-2lag"&gt;Install git CLI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Work on my repo via CLI
&lt;/h2&gt;

&lt;p&gt;To work locally on the repository owned by me via the command line I first need to clone it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Clone the repository locally
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://github.com/ShulyAvraham/shulyavraham.github.io/"&gt;my repo&lt;/a&gt; online &lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Code&lt;/code&gt; 

&lt;ul&gt;
&lt;li&gt;Select either &lt;code&gt;HTTPS&lt;/code&gt; or &lt;code&gt;SSH&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;SSH&lt;/code&gt;: Recommended! 

&lt;ul&gt;
&lt;li&gt;We will need authentication in the form of &lt;a href="https://dev.to/shulyavraham/ssh-key-pair-3ij8"&gt;SSH key&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;HTTPS&lt;/code&gt;: In case for some reason the SSH will not work, we can use HTTPS since it's a public project, but it will require authentication for every pull and push.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open the installed command line (e.g. bash on Linux, GitHub CLI)&lt;/li&gt;
&lt;li&gt;Copy the URL to paste in the &lt;code&gt;git clone&lt;/code&gt; command&lt;/li&gt;
&lt;li&gt;Answer &lt;code&gt;yes&lt;/code&gt; to  the question whether you're sure you want to connect...
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone git@github.com:ShulyAvraham/shulyavraham.github.io.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;A folder with the repository is created locally. &lt;/li&gt;
&lt;li&gt;This folder can be moved anywhere, as all the information is contained within it. &lt;/li&gt;
&lt;li&gt;I can now edit files in any editor or via the command line&lt;/li&gt;
&lt;li&gt;To run &lt;code&gt;git&lt;/code&gt; commands I should enter this folder
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l
cd shulyavraham.github.io.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Git CLI commands
&lt;/h2&gt;

&lt;p&gt;Communicate between my local repository and my own remote repository (vs. a public open source repo not owned by me).&lt;/p&gt;

&lt;p&gt;The recommendation for continuous integration is for all users to work on the same main branch. This is to quickly identify and prevent conflicts during merge.&lt;/p&gt;

&lt;h3&gt;
  
  
  Edit files and interact with git
&lt;/h3&gt;

&lt;p&gt;Open a file using some editor, edit then save it. &lt;/p&gt;

&lt;p&gt;From the command line:&lt;/p&gt;

&lt;p&gt;Let's see what changed in git&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;It will show that the file was modified (since the last commit). Now the file is only changed locally, but not in git. In order to add it to git:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Another &lt;code&gt;git status&lt;/code&gt; will reveal that the file was added to git's &lt;strong&gt;staging area&lt;/strong&gt;. In order add it to the git repo we will commit the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m'a comment describing the change'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first time I communicate with git it will recommend me to configure my username and email. These are not being checked, but used to identify whom preformed which commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Shuly Avraham"
git config --global user.email"Shuly.Avraham@mymail.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the commit, another &lt;code&gt;git status&lt;/code&gt; will reveal that there's nothing to commit and that my tree is clean. &lt;/p&gt;

&lt;p&gt;However, my branch is ahead of &lt;strong&gt;origin&lt;/strong&gt;/main. &lt;strong&gt;origin&lt;/strong&gt; represents the &lt;strong&gt;remote repository&lt;/strong&gt;. So that my local branch is 1 commit ahead of the remote branch.&lt;/p&gt;

&lt;p&gt;To push my change to my remote repo&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another &lt;code&gt;git status&lt;/code&gt; will reveal that my local repo is identical to the remote repo, of the main branch.&lt;/p&gt;

&lt;p&gt;Since I did &lt;code&gt;git push&lt;/code&gt;, I can now see the changes on the remote site.&lt;/p&gt;

&lt;p&gt;Add a new file. &lt;code&gt;git status&lt;/code&gt; will show that the file is untracked.&lt;/p&gt;

&lt;p&gt;Modify another file.&lt;/p&gt;

&lt;p&gt;Now we have two files that are unstaged. We can add all the modified to the &lt;strong&gt;staging area&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now the next commit will include both changes. &lt;/p&gt;

&lt;p&gt;If I want only specific file or files to be included in a specific commit, even though I made changes to other files as well, I will specify the file names in the git add, and then commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add somefilename
git commit -m'A specific change'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is advised to include only files with related changes in a specific commit.&lt;/p&gt;

&lt;p&gt;To check what changed since the last commit to my local changes&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To see changes since last commit to my staging area&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To restore files from staging area&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git restore --staged filename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see my history of commits&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;A tool to view changes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gitk --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cancel and delete last commit. &lt;strong&gt;NOT RECOMMENDED&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The number represents the number of commits back.&lt;/p&gt;

&lt;p&gt;The change is still in my local file. To delete also the local change&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset HEAD~1 –hard

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see a change in a specific commit&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;To see the difference between a commit and what I have now&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Some more commands&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rm --cached &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove from staging&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Remote mapping
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;We will see the mapping of the remote repos for fetch (pull) and push. Normally &lt;code&gt;origin&lt;/code&gt;, but this can be changed. Also, we can have different remotes for pull and push.&lt;/p&gt;

&lt;h2&gt;
  
  
  The .git directory
&lt;/h2&gt;

&lt;p&gt;Inside the root dir of our local repo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Will reveal the &lt;strong&gt;.git&lt;/strong&gt; directory which contains all the changes to the git repo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;config&lt;/strong&gt; file contains git configuration. (such as user info, remote repo info, etc.]&lt;/p&gt;

&lt;p&gt;It can be edited directly or by git configuration commands via the command line which will keep changes in this file.&lt;/p&gt;

</description>
      <category>osdc</category>
      <category>opensource</category>
      <category>github</category>
      <category>programming</category>
    </item>
    <item>
      <title>Deploy and run the OSDC website locally</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Mon, 16 Jan 2023 08:20:19 +0000</pubDate>
      <link>https://dev.to/shulyavraham/run-the-osdc-website-locally-17k1</link>
      <guid>https://dev.to/shulyavraham/run-the-osdc-website-locally-17k1</guid>
      <description>&lt;h1&gt;
  
  
  Follow these steps to deploy the OSDC code and run the website locally
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Assuming you have Python installed locally on a Linux machine or WSL (Windows Subsystem for Linux) on Windows&lt;/li&gt;
&lt;li&gt;Run the following on Linux shell:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git clone https://github.com/ShulyAvraham/osdc-2023-01-public.git
$ cd osdc-2023-01-public
$ sudo apt install python3-pip # If you don't already have one
$ pip install -r requirements.txt
$ python generate.py 
$ python app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;On your web browser open the OSDC website &lt;a href="http://127.0.0.1:5000" rel="noopener noreferrer"&gt;http://127.0.0.1:5000&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Markdown tips beyond basics on dev.to</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 15 Jan 2023 15:15:44 +0000</pubDate>
      <link>https://dev.to/shulyavraham/blog-series-on-devto-3m1b</link>
      <guid>https://dev.to/shulyavraham/blog-series-on-devto-3m1b</guid>
      <description>&lt;h1&gt;
  
  
  Create a series of blog posts
&lt;/h1&gt;

&lt;p&gt;To make a series out of several blog posts, add the following to the beginning of every post in that series:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
series: SomeSeriesName
---
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Link to somebody's dev.to profile
&lt;/h1&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;a class="mentioned-user" href="https://dev.to/shulyavraham"&gt;@shulyavraham&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@person_username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h1&gt;
  
  
  Include an embedded person's card
&lt;/h1&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__user ltag__user__id__978478"&gt;
    &lt;a href="/shulyavraham" class="ltag__user__link profile-image-link"&gt;
      &lt;div class="ltag__user__pic"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--E1nANe4A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--yY5E_WXs--/c_fill%2Cf_auto%2Cfl_progressive%2Ch_150%2Cq_auto%2Cw_150/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/978478/77f41aa8-edad-41ec-946c-a70159a45378.jpg" alt="shulyavraham image"&gt;
      &lt;/div&gt;
    &lt;/a&gt;
  &lt;div class="ltag__user__content"&gt;
    &lt;h2&gt;
&lt;a class="ltag__user__link" href="/shulyavraham"&gt;ShulyAvraham&lt;/a&gt;Follow
&lt;/h2&gt;
    &lt;div class="ltag__user__summary"&gt;
      &lt;a class="ltag__user__link" href="/shulyavraham"&gt;Works at Hazera Seeds, Israel.&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{% embed https://personBlogURL.com %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>osdc</category>
    </item>
    <item>
      <title>OSDC lesson 2: Create a website for you and your projects on github</title>
      <dc:creator>ShulyAvraham</dc:creator>
      <pubDate>Sun, 15 Jan 2023 15:05:00 +0000</pubDate>
      <link>https://dev.to/shulyavraham/osdc-2-a-website-for-you-and-your-projects-on-github-1km9</link>
      <guid>https://dev.to/shulyavraham/osdc-2-a-website-for-you-and-your-projects-on-github-1km9</guid>
      <description>&lt;h1&gt;
  
  
  GitHub pages
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Create my own website on GitHub step by step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Create a repository &lt;em&gt;github_username.github.io&lt;/em&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Within &lt;a href="https://github.com/ShulyAvraham"&gt;my GitHub&lt;/a&gt; create a new repository:

&lt;ul&gt;
&lt;li&gt;Click &lt;code&gt;Repositories&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;New&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Repository name must be: &lt;em&gt;github_username.github.io&lt;/em&gt;, in my case &lt;a href="//shulyavraham.github.io"&gt;shulyavraham.github.io&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Create repository&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;So, now I have a &lt;a href="https://github.com/ShulyAvraham/shulyavraham.github.io/"&gt;new repository&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Create a new file named &lt;em&gt;index.md&lt;/em&gt; in the new repo 

&lt;ul&gt;
&lt;li&gt;Add some markdown text to the file and click &lt;code&gt;Commit new file&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Generate the pages
&lt;/h3&gt;

&lt;p&gt;Create the pages&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;code&gt;Settings&lt;/code&gt; on the top menu
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Pages&lt;/code&gt; on the left menu&lt;/li&gt;
&lt;li&gt;Select &lt;code&gt;Deploy from branch&lt;/code&gt; in the &lt;code&gt;Source&lt;/code&gt; drop down &lt;/li&gt;
&lt;li&gt;Select the &lt;code&gt;main&lt;/code&gt; branch&lt;/li&gt;
&lt;li&gt;You can select the directory which will server the pages, either &lt;code&gt;root&lt;/code&gt; or &lt;code&gt;docs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Save&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  View my website
&lt;/h3&gt;

&lt;p&gt;Now &lt;a href="//shulyavraham.github.io"&gt;my website&lt;/a&gt; was created with an index page&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the URL &lt;a href="//shulyavraham.github.io"&gt;shulyavraham.github.io&lt;/a&gt; in the browser&lt;/li&gt;
&lt;li&gt;You should see the index page you crated previously&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Edit the website and add new pages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The markdown file can now be edited and committed to design the page

&lt;ul&gt;
&lt;li&gt;This is now my own project, so I can &lt;code&gt;Commit changes&lt;/code&gt; to my own repo&lt;/li&gt;
&lt;li&gt;Any commit to the page will result in the deployment of the web page, which I can view on &lt;a href="//shulyavraham.github.io"&gt;my website&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub automatically generates HTML from my markdown files using &lt;a href="https://jekyllrb.com/"&gt;Jekyll&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I can now create more pages in an .md format which will be generated to HTML when committed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new file &lt;strong&gt;about.md&lt;/strong&gt; and edit it&lt;/li&gt;
&lt;li&gt;Link to the new page from the index page

&lt;ul&gt;
&lt;li&gt;Edit &lt;strong&gt;index.md&lt;/strong&gt; and add:
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Link to about](about)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Configure my web pages theme
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://github.com/ShulyAvraham/shulyavraham.github.io"&gt;my repo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Create a new file in the root dir &lt;code&gt;Add file&lt;/code&gt;-&amp;gt;&lt;code&gt;Create new file&lt;/code&gt;-&amp;gt;&lt;code&gt;File name&lt;/code&gt;: &lt;strong&gt;'_config.yml'&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Edit the file to add a theme and title to my pages
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;theme: jekyll-theme-cayman
title: ShulyA's GitHub Page 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Commit new file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;View &lt;a href="//shulyavraham.github.io"&gt;my website&lt;/a&gt; with the new theme (it may take a few seconds for the changes to take effect)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://pages.github.com/themes/"&gt;Supported themes for GitHub pages&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To use one of the supported themes add the following to the &lt;strong&gt;_config.yml&lt;/strong&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remote_theme: pages-themes/architect@v0.2.0 # depending on the selected theme
plugins:
- jekyll-remote-theme # add this line to the plugins list if you already have one
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Use your own domain to redirect to the GitHub site
&lt;/h3&gt;

&lt;p&gt;3 things must happen, the first 2 are external to GitHub&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You have your own domain name e.g. github.shulyavraham.com&lt;/li&gt;
&lt;li&gt;Configure your host provider so that your hostname will map to GitHub&lt;/li&gt;
&lt;li&gt;Add a file called &lt;strong&gt;CNAME&lt;/strong&gt; to your GitHub repo, and edit it to include the hostname, e.g.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;github.shulyavraham.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add other repositories as subfolders of the &lt;a href="//shulyavraham.github.io"&gt;main site&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;If I have other repos from which I generate GitHub pages, they will automatically appear as &lt;a href="//shulyavraham.github.io/qqrq"&gt;sub folders&lt;/a&gt; of my &lt;a href="//shulyavraham.github.io"&gt;main site repo&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new repo &lt;strong&gt;qqrq&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Go to &lt;code&gt;Settings&lt;/code&gt;-&amp;gt;&lt;code&gt;Pages&lt;/code&gt;-&amp;gt;&lt;code&gt;Save&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The new repo's site pages will be generated and added as &lt;a href="//shulyavraham.github.io/qqrq"&gt;sub folder&lt;/a&gt; to the main repo website&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Some tips
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Embed an image from the web on my page
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Search for an image on google&lt;/li&gt;
&lt;li&gt;Select the image&lt;/li&gt;
&lt;li&gt;Right click the image and select &lt;code&gt;Copy image address&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the markdown file add:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;![](http://the_image_address/image_name.jpg)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modify the main index page to be served from &lt;strong&gt;/docs&lt;/strong&gt; rather than &lt;strong&gt;/root&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In case you initially chose to serve the website from the /root dir, but decided to change it to the /docs dir&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;code&gt;Settings&lt;/code&gt;-&amp;gt;&lt;code&gt;Pages&lt;/code&gt;-&amp;gt;&lt;code&gt;Branch&lt;/code&gt;-&amp;gt;Select &lt;code&gt;/Docs&lt;/code&gt;-&amp;gt;&lt;code&gt;Save&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>osdc</category>
      <category>opensource</category>
      <category>programming</category>
      <category>github</category>
    </item>
  </channel>
</rss>
