<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by İbrahim BABAL on Medium]]></title>
        <description><![CDATA[Stories by İbrahim BABAL on Medium]]></description>
        <link>https://medium.com/@yourcasualdev?source=rss-d00f44cc48da------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*w-WdNHFCFUQ6sFgMz_6y5A.jpeg</url>
            <title>Stories by İbrahim BABAL on Medium</title>
            <link>https://medium.com/@yourcasualdev?source=rss-d00f44cc48da------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:51:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yourcasualdev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Host your own Minecraft server on Google Cloud for Free]]></title>
            <link>https://yourcasualdev.medium.com/host-your-own-minecraft-server-on-google-cloud-for-free-5c006db0c3f6?source=rss-d00f44cc48da------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c006db0c3f6</guid>
            <category><![CDATA[server-hosting]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[minecraft-servers]]></category>
            <category><![CDATA[minecraft]]></category>
            <category><![CDATA[minecraft-server-hosting]]></category>
            <dc:creator><![CDATA[İbrahim BABAL]]></dc:creator>
            <pubDate>Fri, 30 Aug 2024 21:22:28 GMT</pubDate>
            <atom:updated>2024-08-30T21:22:28.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HG-MY36049VuSx6UFleWtA.png" /></figure><p>I love playing Minecraft with my friends. But It sucks that my computer needs to be on for them to play. So I often leave my computer on before sleep so they can continue playing. So today we will solve this problem by creating our server on the cloud on 7/24 and completely free.</p><h4><strong>1. Create a Google Cloud Account</strong></h4><p>Go to <a href="https://cloud.google.com/">https://cloud.google.com</a> and create an account. It will ask you for credit card information to prove you are human. Do not worry because you will not charged until you manually activate your paid account as per the following sentence:</p><blockquote>Automatic payments only begin once you manually activate a paid Google Cloud account.</blockquote><p>When you create your account google will give you 300 dollar credit for 3 months. This is more than enough for our server.</p><ul><li><strong><em>Do I get charged if I exceed my Google Cloud credits on a free account?</em></strong><br>- NO! You will not charged in any way unless you manually activate a paid account!</li><li><strong><em>Am I gonna get charged when the free trial ends end I forgot the server on.<br>- </em></strong>Still NO! You will not get charged unless you activate a paid account!</li></ul><h4><strong>So do not upgrade your account to a paid tier unless you know what you are doing!</strong></h4><h4>2. <strong>Create a Virtual Machine</strong></h4><p>Go to <strong>Compute</strong> <strong>Engine &gt; VM Instances </strong>and click Create Instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMJ2b2zdDl7rxJlTrCF5Tg.png" /></figure><ul><li>Name= -name it whatever you want-</li><li>Region= -select the one closes to you-</li><li>Zone= Any</li><li>Machine configuration=E2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T0q9nrxXVt-9Krpm0xFUjQ.png" /></figure><ul><li>Machine Type= e2-medium</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wuHi4sOUiNfMATpIfjJ_UQ.png" /></figure><ul><li>Firewall= Allow HTTP and HTTPS traffic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*WwB43qTBsdeenyvqkaeC7A.png" /></figure><p>After you select all the options above, click the Create button below.</p><h4>3. <strong>Setup Java</strong></h4><p>Once your server is initiated and ready click the SSH button in the list, after you click there will be a window open with a terminal connected to your server.</p><p>First, update your dependencies</p><pre>sudo apt update<br>sudo apt upgrade</pre><p>Then, download SDKMAN!</p><pre>curl -s &quot;https://get.sdkman.io&quot; | bash<br>source &quot;$HOME/.sdkman/bin/sdkman-init.sh&quot;</pre><p>Install Java</p><pre>sdk install java</pre><h4>4. <strong>Install Minecraft Server</strong></h4><p>First, copy the download link from <a href="https://www.minecraft.net/en-us/download/server">Minecraft Official Website</a> then download Minecraft using wget.</p><p>Create a folder called minecraft-server and cd into it.</p><pre>mkdir ~/minecraft-server<br>cd ~/minecraft-server</pre><p>Then download Minecraft with the link you have like below (paste your own link)</p><pre>wget https://launcher.mojang.com/v1/objects/[server_version_hash]/server.jar -O server.jar</pre><p>Then start the server:</p><pre>java -Xmx1024M -Xms1024M -jar server.jar nogui</pre><p>Minecraft will generate the necessary files and will ask you to accept eula so change the text yourself or run the following:</p><pre>echo &quot;eula=true&quot; &gt; eula.txt</pre><p>Now our Minecraft server is ready to launch but we need to make some configurations to access it with our computers.</p><h4>5. Configure Firewall</h4><p>Install ufw to set firewall rules:</p><pre>sudo apt update<br>sudo apt install ufw</pre><p>Enable ufw:</p><pre>sudo ufw enable</pre><p>And allow the port used by your Minecraft server (default is 25565):</p><pre>sudo ufw allow 25565/tcp</pre><p>don’t forget to allow the ssh port before closing the terminal window. (If you don’t you can not access the ssh terminal. But you can fix it somehow.)</p><pre>sudo ufw allow 22/tcp</pre><p>Now our server&#39;s firewall is done. Now we need to configure virtual machine firewalls on Google Cloud. Navigate to <strong>VPC network</strong> &gt; <strong>Firewall rules. </strong>Click Create Firewall Policy and Set the following:</p><ul><li><strong>Name</strong>: minecraft-server-rule</li><li><strong>Network</strong>: Default</li><li><strong>Targets</strong>: All instances in the network</li><li><strong>Source IP ranges</strong>: 0.0.0.0/0 (This allows access from any IP address)</li><li><strong>Protocols and ports</strong>: tcp:25565</li></ul><p>Click Create</p><h4>6. Launch the Server</h4><p>We can launch the server now but we would want to start the server in a process so it will not terminate after we close the terminal. So we need to install Screen.</p><pre>sudo apt install screen</pre><p>Run screen</p><pre>screen</pre><p>Then launch the minecraft server</p><pre>java -Xmx1024M -Xms1024M -jar server.jar nogui</pre><p>Now you can exit that window with ctrl + a + d and your server will keep running. You can learn more about <a href="https://linuxize.com/post/how-to-use-linux-screen/">screen</a> and attach/detach windows.</p><p>You can change the properties of your server by changing server.properties the file located next to the server itself.</p><h4>7. Connect to your server</h4><p>Open Minecraft and navigate to <strong>Multiplayer &gt; Add Server</strong>. Give it a name and put your server ip + the port that the game is running like xx.xx.xx.xx:25565 you can see your servers ip like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_XuM9QqmrgZAC4BisU4RdA.png" /></figure><p>And that&#39;s all. Now your friends can enjoy the world even when you are offline (I’m not sure if it&#39;s a good thing or bad). This is just a start, you can learn to protect your server, manage people with server management add-ons, and many more.</p><p>Don’t forget to get your world&#39;s backup before the free trial ends. Then you can do the same thing and continue running your server free.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c006db0c3f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why is my useState hook not working properly?]]></title>
            <link>https://yourcasualdev.medium.com/why-is-my-usestate-hook-not-working-properly-2654b574d8cf?source=rss-d00f44cc48da------2</link>
            <guid isPermaLink="false">https://medium.com/p/2654b574d8cf</guid>
            <category><![CDATA[hooks]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[usestate]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[İbrahim BABAL]]></dc:creator>
            <pubDate>Sun, 22 Jan 2023 10:03:09 GMT</pubDate>
            <atom:updated>2023-01-22T10:03:09.337Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LrrmNkj1qe8Lf4QwFEwx5Q.png" /><figcaption>Wrong way to use useState hook</figcaption></figure><p>React’s useState hook is a powerful tool for managing component state, but it&#39;s important to understand the correct way to use it in order to avoid bugs and unexpected behavior. One common mistake is updating the properties of an object in state directly, rather than creating a new copy of the state and updating it.</p><h3>The Problem</h3><p>Consider the following example:</p><pre>import { useState } from &#39;react&#39;;<br><br>function MyComponent() {<br>  const [user, setUser] = useState({ name: &#39;John&#39;, age: 30 });<br>  const handleClick = () =&gt; {<br>    // WRONG: This will NOT trigger a re-render<br>    user.age += 1;<br>    setUser(user);<br>  };<br>  return (<br>    &lt;&gt;<br>      &lt;div&gt;Name: {user.name}&lt;/div&gt;<br>      &lt;div&gt;Age: {user.age}&lt;/div&gt;<br>      &lt;button onClick={handleClick}&gt;Increment Age&lt;/button&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>In this example, when the button is clicked, the handleClick function is supposed to increment the user&#39;s age by 1. However, because the code is directly modifying the user object&#39;s properties, React will not recognize that the state has changed and therefore will not trigger a re-render.</p><h3>The Solution</h3><p>The correct way to update an object’s properties in a useState hook is to create a new object and spread the existing state into it, then update the desired property, and call setState with that new object:</p><pre>import { useState } from &#39;react&#39;;<br><br>function MyComponent() {<br>  const [user, setUser] = useState({ name: &#39;John&#39;, age: 30 });<br>  const handleClick = () =&gt; {<br>    // CORRECT: This will trigger a re-render<br>    setUser({...user, age: user.age + 1 });<br>  };<br>  return (<br>    &lt;&gt;<br>      &lt;div&gt;Name: {user.name}&lt;/div&gt;<br>      &lt;div&gt;Age: {user.age}&lt;/div&gt;<br>      &lt;button onClick={handleClick}&gt;Increment Age&lt;/button&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>Another way to update an object’s properties would be to use the callback form of setState, passing in the previous state and returning the new state:</p><pre>import { useState } from &#39;react&#39;;<br><br>function MyComponent() {<br>  const [user, setUser] = useState({ name: &#39;John&#39;, age: 30 });<br>  const handleClick = () =&gt; {<br>    // CORRECT: This will trigger a re-render<br>    setUser(prevUser =&gt; {<br>        return {...prevUser, age: prevUser.age + 1 }<br>    });<br>  };<br>  return (<br>    &lt;&gt;<br>      &lt;div&gt;Name: {user.name}&lt;/div&gt;<br>      &lt;div&gt;Age: {user.age}&lt;/div&gt;<br>      &lt;button onClick={handleClick}&gt;Increment Age&lt;/button&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><h3>Conclusion</h3><p>It’s very important to keep in mind that when using the useState hook, you should never modify the state directly. Instead, you should create a new copy of the state and update it accordingly in order to trigger a re-render</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2654b574d8cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why am I using WSL2 as my development environment ?]]></title>
            <link>https://yourcasualdev.medium.com/the-perfect-development-envirement-doesnt-exi-8bbe46331b6b?source=rss-d00f44cc48da------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bbe46331b6b</guid>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[İbrahim BABAL]]></dc:creator>
            <pubDate>Fri, 01 Jul 2022 19:08:35 GMT</pubDate>
            <atom:updated>2022-07-13T07:05:59.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Yqtv9px0IbgLdHgRonrpw.png" /></figure><h3>Development on Windows sucks</h3><p>I don’t know how many times I format my computer to change my OS. I’m switching to Linux for a better development experience. But then, when I want to play some games, Linux isn’t a place for doing it. Even tho there is a bunch of tutorials that shows how to do that, I don’t want to spend days for installing a game. It just doesn’t make sense. I even tried dual boot on my ssd but I found myself using only Windows because I’m too lazy to turning off my computer -&gt; opening bios -&gt; switching the OS and then restarting again every single time. It such a waste of time.</p><h3>The chaotic good</h3><p>Today we are gonna take both advantages of these two Operating Systems. Gaming on Windows and powerful terminal and development tools of Linux in one place.</p><h3>WSL 2</h3><p>Windows Subsystem for Linux lets you use GNU/Linux directly on your Windows machine. Just open a terminal and start using it. There is no need to start a Virtual Machine and wait for it to open (WSL2 has much more performance compared to virtual machines because it runs on Windows natively).</p><h4>How to setup WSL 2</h4><p>First open a PowerShell window with admin permissons and run the command below and restart your computer.</p><pre>Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux</pre><p>Then install the WSL with this command.</p><pre>wsl --install</pre><p>Now head over to Microsoft Store and download Ubuntu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*2DjSEFUFUOjm0PSEpT6hDQ.png" /></figure><p>When it’s downloaded open it and it will ask you for a username and a password just type it and wait for it to complete installation.</p><p>It has to be version two by defult. You can check the version with wsl -l -v . Ones you see a output like this we can move to next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*7O40rK3P4t-bTT75rmHA1A.png" /></figure><h3>VSCode</h3><p>I’m assuming you have Visual Studio Code installed but if you don’t, I strongly recommend it for you because VSCode can open directly on WSL. So head over to this <a href="https://code.visualstudio.com/">page </a>and install it. If you have VSCode then go to the Extensions tab and install the Remote-WSL extension.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*NUuYhw1nUxpdSAQWoLhC7Q.png" /></figure><p>Ones you done that open Windows Terminal (If you don’t have I’m strongly recommand it. Download it via MicrosoftStore) and open the ubuntu tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*wysesBj6hXYC_W_nEKOm_Q.png" /></figure><p>Just create a folder with mkdir foo and open it on VSCode with code ./foo it will automatically install the necessary packages for opening vscode on remote and you have your VSCode on Linux on Windows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*ikvLLpTspQ7WVc628Gxcqw.png" /></figure><p>And that’s all. Strong knowledge of Linux is a big plus in the industry. With this setup, you can explore Linux without hesitating.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bbe46331b6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make Your Terminal Look Awesome]]></title>
            <link>https://yourcasualdev.medium.com/make-your-terminal-look-awesome-5ec507ba7cf9?source=rss-d00f44cc48da------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ec507ba7cf9</guid>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[vscode]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[oh-my-posh]]></category>
            <dc:creator><![CDATA[İbrahim BABAL]]></dc:creator>
            <pubDate>Mon, 06 Jun 2022 20:22:58 GMT</pubDate>
            <atom:updated>2022-06-06T20:22:58.815Z</atom:updated>
            <content:encoded><![CDATA[<h3>Make Your VS Code Terminal Look Awesome</h3><p>Change your integrated terminal from this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*2Zxoqe4f-85kW4kqEuGRiw.png" /><figcaption>VS Code default terminal</figcaption></figure><p>To this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*Kog1LcBsmCKkOzJnRarWgQ.png" /><figcaption>VS Code integrated terminal with oh-my-posh</figcaption></figure><h3>Summary</h3><p>In this article we are gonna use oh-my-posh and Nerd fonts. We are not only gonna set this up for VS Code integrated terminal, it’s also be avaliable for our external terminal like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gT-ddxpcVtBFV-ikuCwn5Q.png" /><figcaption>Windows Terminal with oh-my-posh</figcaption></figure><h3>Installing Windows Terminal and PowerShell 7</h3><p>First head over the Microsoft Store and download the <a href="https://www.microsoft.com/store/productId/9N0DX20HK701">Windows Terminal</a>. After that run this command to install PowerShell 7:</p><blockquote>winget install --id Microsoft.Powershell -<em>-source</em> winget</blockquote><h3>Installing oh-my-posh</h3><p>Oh My Posh is a custom prompt engine for any shell that has the ability to adjust the prompt string with a function or variable.</p><blockquote><strong><em>winget install oh-my-posh</em></strong></blockquote><p>Then use this command to activate oh-my-posh</p><blockquote><strong>oh-my-posh get shell</strong></blockquote><p>Create a PowerShell Profile script:</p><blockquote><strong>New-Item -Path $PROFILE -Type File -Force</strong></blockquote><p>Open that with notepad:</p><blockquote><strong>notepad $PROFILE</strong></blockquote><p>Then add the line below:</p><blockquote><strong>oh-my-posh init pwsh | Invoke-Expression</strong></blockquote><h3>Installing Nerd Fonts</h3><p>After the installations abow, you need to see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*BTCJ_OoiGKc9-7XKGXM8Gw.png" /><figcaption>without Nerd Fonts</figcaption></figure><p>We’ll fix that soon. Now install <a href="https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip?WT.mc_id=-blog-scottha">Caskaydia Cove Nerd Font Complete</a> open it and on that opening window, click install. Then head over to Terminal open <em>Settings &gt; Defaults &gt; Appearance </em>and select the font that you installed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*-1AWr3rQd_fZe_KU4roF5g.png" /></figure><p>for now your terminal should looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LIQnl1jE_gKwSS_xhDGPqw.png" /><figcaption>Better terminal</figcaption></figure><h3><strong>Setting VS Code Integrated terminal</strong></h3><p>Now we are gonna set VS Code for oh-my-posh. Open Command Palette and type<em> </em><strong><em>Terminal: Select Default Profile</em></strong><em> </em>and select<em> </em><strong><em>Powershell </em></strong>as your default terminal.</p><p>Open your integrated terminal, you should see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*yBNOjqM5OoVG-eD8ffpJoQ.png" /><figcaption>Bad VS Code terminal</figcaption></figure><p>Open Command Palette again and select <strong><em>Preferences: Open Settings (JSON) </em></strong>in the json file add following:</p><pre>// Controls the font family.</pre><pre>&quot;editor.fontFamily&quot;: &quot;DejaVuSansMono Nerd Font&quot;,</pre><pre>// Controls the font size.</pre><pre>&quot;editor.fontSize&quot;: 14,</pre><p>When you save that file your terminal should look better:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vq_6WQBsMZJXyQSO9APLg.png" /><figcaption>Good VS Code terminal</figcaption></figure><h3>References</h3><ul><li><a href="https://ohmyposh.dev/">Home | Oh My Posh</a></li><li><a href="https://www.nerdfonts.com/">Nerd Fonts - Iconic font aggregator, glyphs/icons collection, &amp; fonts patcher</a></li><li><a href="https://www.hanselman.com/blog/my-ultimate-powershell-prompt-with-oh-my-posh-and-the-windows-terminal">My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal</a></li><li><a href="https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows?view=powershell-7.2">Installing PowerShell on Windows - PowerShell</a></li><li><a href="https://stackoverflow.com/a/29961309">Which font is used in Visual Studio Code Editor and how to change fonts?</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ec507ba7cf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>