<?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>Forem: Bruno Robert</title>
    <description>The latest articles on Forem by Bruno Robert (@brunorobert).</description>
    <link>https://forem.com/brunorobert</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%2F276080%2F9e02aba4-22b6-4368-81f6-d4d822c84396.jpg</url>
      <title>Forem: Bruno Robert</title>
      <link>https://forem.com/brunorobert</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/brunorobert"/>
    <language>en</language>
    <item>
      <title>Real life GTA cheat code. Fixing broken firmware on bose soundlink mini II</title>
      <dc:creator>Bruno Robert</dc:creator>
      <pubDate>Fri, 25 Jun 2021 20:41:16 +0000</pubDate>
      <link>https://forem.com/brunorobert/real-life-gta-cheat-code-fixing-broken-firmware-on-bose-soundlink-mini-ii-246n</link>
      <guid>https://forem.com/brunorobert/real-life-gta-cheat-code-fixing-broken-firmware-on-bose-soundlink-mini-ii-246n</guid>
      <description>&lt;p&gt;So I got myself a bose mini soundlink II speaker a while back. It's a great little speaker with some impressive dynamic range and power in such a small box.&lt;/p&gt;

&lt;p&gt;All was good until one day, I let it discharge too much and somehow, the firmware on the device got corrupted. The speaker would no longer charge, instead showing a red flashing light.&lt;/p&gt;

&lt;p&gt;I went online, read forum posts and even contacted bose support. Everyone told me to put it in shipping mode and back... but to no avail. &lt;br&gt;
Bose ended up telling me to ship it to them and they would fix it, but since it was no longer un guarantee, I would pay for shipping and the repair. This would cost way more than just buying the speaker second hand on ebay, so I opted to not fix it.&lt;/p&gt;

&lt;p&gt;Fast forward to multiple months later, and I stumble upon a &lt;a href="https://www.youtube.com/watch?v=GSx7GgYrE7Q"&gt;youtube video&lt;/a&gt;, with music in the right ear and explanations in the left, telling me there is actually a way of fixing this. All you do, is download the firmware update software from &lt;a href="//btu.bose.com"&gt;bose's website&lt;/a&gt; and flash new firmware on it.&lt;/p&gt;

&lt;p&gt;I unfortunately already tried this, but since my bose is already on the latest version, the tool won't even attempt to update it. But this is when I am transmitted the ancient knowledge, a cheat code not even bose support know's about:&lt;/p&gt;

&lt;p&gt;A, D, V, Up, Down&lt;/p&gt;

&lt;p&gt;And just like that, the firmware update software is now in dev mode and will allow flashing of old and current firmware (you enter this code on the web-interface of the firmware update tool).&lt;/p&gt;

&lt;p&gt;I flash my speaker with the current firmware. It gets stuck at about 80% but this time, it is actually charging. I allow it to charge for a few hours, then flashed it a second time. And this time it works.&lt;/p&gt;

&lt;p&gt;I wonder what other cheat codes exists out there... and why bose creates tools that are never used.&lt;/p&gt;

</description>
      <category>sideprojects</category>
    </item>
    <item>
      <title>Github and Gitlab sync</title>
      <dc:creator>Bruno Robert</dc:creator>
      <pubDate>Sun, 21 Mar 2021 03:02:46 +0000</pubDate>
      <link>https://forem.com/brunorobert/github-and-gitlab-sync-44mn</link>
      <guid>https://forem.com/brunorobert/github-and-gitlab-sync-44mn</guid>
      <description>&lt;p&gt;Both Github and Gitlab are great ways to host your git repositories online. They both have great tools to manage your project, be it open source or private code.&lt;br&gt;
I'm not going to compare both services in depth since many guides already do so. For me, the general difference between Github and Gitlab is Gitlab is focusing more effort on CI/CD pipelines and tools for companies whereas Github is focused more on the community and creating a platform to share open-source code.&lt;br&gt;
Both can be used for either scenario... which makes it really hard to choose between them!&lt;/p&gt;

&lt;p&gt;But what if I told you you didn't have to choose O_o?&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I want to use both Gitlab and Github
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Just a quick disclaimer, this is the method I use. It works for me but might not work for everyone. I recommend experimenting with things for yourself, do some tests.&lt;/em&gt;&lt;br&gt;
&lt;em&gt;I'm sharing my experience because I feel that it could be useful for someone in the same position as me.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I like to be able to organize my repositories into projects (or groups in Gitlab). Unfortunately, Github doesn't do this.&lt;br&gt;
I also want to be able to reach as many people as possible with my repositories, Github has the largest community.&lt;br&gt;
Damn it, I'm stuck, I want features from both providers.&lt;/p&gt;

&lt;p&gt;Luckily for me, Gitlab has two things that make symbiosis between the two tools possible:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Github repository import 
This makes importing a repository from Github super easy&lt;/li&gt;
&lt;li&gt;Repository synchronization from Gitlab -&amp;gt; Github (for free)
This allows me to use Gitlab as the main source of truth but also have the repository on Github. I can use Github's issue tracker, wiki and forum (Github discussion)&lt;/li&gt;
&lt;li&gt;Great CI/CD (ok, I lied when I said two things)&lt;/li&gt;
&lt;/ol&gt;

&lt;h1&gt;
  
  
  Sync Gitlab to Github (easy)
&lt;/h1&gt;

&lt;p&gt;This one is simple. You could set up some CI/CD yourself. But Gitlab will automatically do this for you. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to "Settings &amp;gt; Repository &amp;gt; Mirroring repositories"&lt;/li&gt;
&lt;li&gt;Enter your Github repo with your username in front &lt;code&gt;https://&amp;lt;github username&amp;gt;@github.com/path/to/your/repo.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the password field, enter your Github token&lt;/li&gt;
&lt;li&gt;Select push (this requires a subscription)&lt;/li&gt;
&lt;li&gt;Press Mirror repository&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From now on, changes to Gitlab will be mirrored to Github&lt;/p&gt;

&lt;h1&gt;
  
  
  Sync Github to Gitlab (intermediate unless you pay)
&lt;/h1&gt;

&lt;p&gt;There are two ways to do this (both are equivalent just from opposite platforms)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Either you set up a CI/CD pipeline on Github that triggers using a webhook (on push and pull requests).&lt;/li&gt;
&lt;li&gt;Either you set up a CI/CD pipeline on Gitlab that triggers using a webhook (on push and pull requests). &lt;strong&gt;Turns out this is actually a premium feature... You cannot use the pull webhook without paying now&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I personally chose to do this from the Github side since the Github method is free&lt;/p&gt;

&lt;h2&gt;
  
  
  Method 1 Github CI/CD
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create the following secrets in your Github repository

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;TARGET_URL&lt;/code&gt; value: the URL of the Gitlab repository&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TARGET_TOKEN&lt;/code&gt; value: Gitlab token&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TARGET_USERNAME&lt;/code&gt; value: Gitlab username&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;li&gt;Create a Github action for your repository with the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;GitlabSync&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;push&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;delete&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sync&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Git Repo Sync&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;wangchucheng/git-repo-sync@v0.1.0&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Such as https://github.com/wangchucheng/git-repo-sync.git&lt;/span&gt;
        &lt;span class="na"&gt;target-url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.TARGET_URL }}&lt;/span&gt;
        &lt;span class="c1"&gt;# Such as wangchucheng&lt;/span&gt;
        &lt;span class="na"&gt;target-username&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.TARGET_USERNAME }}&lt;/span&gt;
          &lt;span class="s"&gt;# You can store token in your project's 'Setting &amp;gt; Secrets' and reference the name here. Such as ${{ secrets.ACCESS\_TOKEN }}&lt;/span&gt;
        &lt;span class="na"&gt;target-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.TARGET_TOKEN }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Make sure the branch you are pushing to in Gitlab is not protected or allows for force push&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Method 2 Gitlab CI/CD (requires Gitlab premium)
&lt;/h2&gt;

&lt;p&gt;Note that if you have a subscription with Gitlab, you can also do this in a few clicks in the same dashion as how we set up syncing from Gitlab to Github. &lt;/p&gt;

&lt;p&gt;Go to "Settings &amp;gt; Repository &amp;gt; Mirroring repositories"&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Enter your Github repo with your username in front &lt;code&gt;https://&amp;lt;github username&amp;gt;@github.com/path/to/your/repo.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the password field, enter your Github token&lt;/li&gt;
&lt;li&gt;Select pull (this requires a subscription)&lt;/li&gt;
&lt;li&gt;Press Mirror repository&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Manual Setup
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Setup the webhooks
&lt;/h4&gt;

&lt;p&gt;If you created the Gitlab project via the Github import tool then you can completely skip this step.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In your Github repository, go to "Settings &amp;gt; Webhooks"&lt;/li&gt;
&lt;li&gt;Create a new webhook

&lt;ul&gt;
&lt;li&gt;Payload path: &lt;code&gt;https://gitlab.com/api/v4/projects/&amp;lt;gitlab project id&amp;gt;/mirror/pull&lt;/code&gt; (the project id can be found in "Settings &amp;gt; General")&lt;/li&gt;
&lt;li&gt;Content Type: &lt;code&gt;application/json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;SSL Verification: off&lt;/li&gt;
&lt;li&gt;Only send for: push and pull&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Activate&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the Gitlab project, go to "Settings &amp;gt; Webhooks"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;select &lt;strong&gt;Push events&lt;/strong&gt; from the repository and enter the Github repository (with a token if it's private)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Setup the CI/CD Variables
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;In the Gitlab project, go to "Settings &amp;gt; CI/CD &amp;gt; Variables"&lt;/li&gt;
&lt;li&gt;Create a variable with key: &lt;code&gt;ACCESS_TOKEN&lt;/code&gt; and value:  (make it hidden because this is sensitive)

&lt;ol&gt;
&lt;li&gt;Create a variable with key: &lt;code&gt;REMOTE_REPOSITORY_URL&lt;/code&gt; and value: &lt;code&gt;&amp;lt;your Github token&amp;gt;@&amp;lt;your repository URL&amp;gt;&lt;/code&gt; (make it hidden because this is sensitive)&lt;/li&gt;
&lt;/ol&gt;


&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  Setup the CI/CD
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Create a pipeline by either going to "CI/CD &amp;gt; Editor" or by creating a file &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; in your project root and add the following content:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;sync-with-github&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;before_script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git config --global user.name "${GITLAB_USER_NAME}"&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git config --global user.email "${GITLAB_USER_EMAIL}"&lt;/span&gt;
  &lt;span class="na"&gt;script&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git remote add github $REMOTE_REPOSITORY_URL&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git checkout master&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git pull origin master&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git pull github master&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git status&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git push https://root:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_PATH.git HEAD:master&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Caveats
&lt;/h1&gt;

&lt;p&gt;This doesn't come without downsides. Here are a few I have found while testing this setup.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wikis, Issues, Discussions, boards, etc. will not sync between the two hosting providers. This will only sync what is in your repository. There are ways to synchronize the Wikis ( The Wiki is essentially a hidden .git repository and both Github and Gitlab use the same Wiki format )&lt;/li&gt;
&lt;li&gt;It can get confusing to have two remote repositories at the same time&lt;/li&gt;
&lt;li&gt;They can get out of sync if multiple commits happen at two locations at once and create conflicts (I only use this on repositories I and only I use)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>devops</category>
      <category>tooling</category>
      <category>git</category>
    </item>
  </channel>
</rss>
