Posts

Showing posts from 2020

Dipping My Toes Into Github Actions 🤖🏭

Image
 Hello Github Actions GitHub actions are something that I was always curious about but never really explored, recently I took a dive and was able to come up with something that actually solves one of my problems. Gulp Runner on GitHub Actions Marketplace Gulp Runner Like many of us, I have a portfolio site deployed on GitHub Pages. 🌐 It uses SCSS so I have to convert it to CSS pre-deployment, I also like to have my scripts and styles minified. While building the site I used gulp for these tasks and everything worked as it should. The only issue is when I have to make some quick updates to the styles or scripts on a new machine or on my phone, I have to setup the local dev environment along with node, npm and lots of node modules. While reading up on GitHub actions this is the problem that came up to my mind, that can be fixed quite easily using a simple workflow. 🤔 What this action does is, on push events it looks at changes in the script and styles file. If it does find any cha...

Fix MySQL Daemon startup #Fixit 01 🛠️🕵️

 Fixit? In my Fixit series I'll write about quick solutions to problems that I encounter every now and then. Problem Brief: MySQL daemon fails to start Details: So, I recently installed MariaDB (Community fork of MySQL) on my Manjaro system and when I started the system with: sudo systemctl start mysqld This is the error I get: Job for mariadb.service failed because the control process exited with error code. Let's look at journalctl -xe : A start job for unit mariadb.service has finished with a failure. Not very helpful, let's look at mysqld's status with:  systemctl status mysqld  InnoDB: The innodb_system data file 'ibdata1' must be writable Ah, there's the culprit mysql doesn't have write access to this file. Solution  A quick look at the man page and after some google searches the solution I came up with was simple: sudo chmod -R 777 /var/lib/mysql If you are facing any issues while running mysql_secure_installation , you can run  mysql_upgrade -u r...

Manage all your GitHub repositories easliy 🗃️☁️

Image
Do you have a lot of repositories on GitHub and are always making changes to them?  Do you work on multiple machines, and are struggling to keep the repositories in sync? Have you ever moved to a new machine and spent what seems like an eternity cloning all your projects one by one? If your answer to any of these questions was yes, well I have a solution for you.  Introducing  GHPM - GitHub Project Manager It is a utility to fix a few problems a developer faces while managing GitHub projects. GHPM allows you to clone all the repositories in a user's GitHub profile, saving you lots of time. All the repositories will be cloned in the current directory. It lets you pull and push changes for all the git repositories in a directory, saving you lots of cd and git pull/push. It also has a option to quickly change the remote repository protocol from http to ssh, so you don't have to manually use it. You can find all the installation and usage information here . If you...

Remove Screen Flickering OBS 💻📹

I was recently trying out OBS for my new YouTube Channel ! but faced weird flickering issues when recording, after a lot of tweaking I found the solution.  You have to turn of Vsync on your system. On KDE the steps are as follows: Open System Settings Then go to Display and Monitor section Click on Compositor Here, change Tearing Prevention (vsync) to Never This should do the trick. Try again and you shouldn't face flickering issues anymore.

Sync Forked Repository With Upstream 🔁✔️

Here's the situation, You have forked a repository on GitHub, you have made your changes and sent a pull request and that request has been merged.  Now you want to make further changes, but the repository mentions that you are X commits ahead or/and X commits behind upstream repository. So how do you sync it? You can delete your fork and fork the original repository again, but that is a very tedious thing to do. Here's another way to do this: 1. Clone your fork git clone https://github.com/yourname/repo.git cd yourname/repo 2. Add upstream remote git remote add upstream https://github.com/original-author/repo.git git fetch upstream 3. Ignore all changes in fork and sync with upstream git reset --hard upstream/master git push -f origin master Only do this if you have no changes on your fork that you will like to keep. This will set your fork's master to be the same as upstream's master. Now you are free to make any changes you wish to...

Enable Dark Mode On Chrome Everywhere 🌜🌎

Image
Preview of GitHub with Dark Mode There are lots of extensions out there that turn your web browsing experience much better if you prefer dark backgrounds (who doesn't right?). My favourite one is Dark Reader but there's just one problem, mobile versions of chrome don't support extensions. This trick will help you turn on dark mode everywhere. Steps: Visit Chrome flags by entering chrome://flags/ into the address bar. Search for dark in the flags search bar. On Desktop versions you'll have to enable the flag "Force Dark Mode for Web Contents" which is tagged #enable-force-dark . On Android versions you'll have to enable the flag "Darken websites checkbox in themes setting" which is tagged #darken-websites-checkbox-in-themes-setting . Restart Chrome and enjoy the dark side. That's all, Thank you for reading. Hopefully this post was helpful to you, see you in the next one.

Add Two Numbers Without Arithmetic Operators 🙅‍♂️➕

Image
What if you are given a problem where you have to add two integers but you can't use any arithmetic operators ( + - * / % // ** ), like LeetCode's problem #371 . How do we approach this problem? Answer: Bit manipulation Problems like this can be solved using bit-wise operators as basic mathematics rules work in the same way whether it be binary or decimal. All we have to do is: Figure out how the basic mathematical operation works step by step. Replicate these operators using bit-wise operators ( & | ~ ^ << >> ). In case of addition in decimal system the process looks something like this: If sum of two digits is less than 10 we add it to our sum. If sum is greater than 10 then we add the least significant bit to sum and carry 1 to next operation. When doing this operation in binary which bit-wise operators do we need? Let's look at an example: 2 + 1 = 3 2 in binary is 010 1 in binary is 001 3 in binary is 011 Which b...

Control Your Android Device From PC 📱💻

Image
scrcpy running on Linux Wouldn't it be convenient if you could mirror your Android device's screen onto your PC and interact with it? I have just the right tool for this job that lets you do all this and more and it's called "scrcpy". It is a tool created by folks at Genymotion. What you'll need: Android device with Lollipop (API 21 / Android 5.0) or newer with USB debugging turned on. adb - Android debugging bridge. scrcpy itself. Installation instructions: Windows: You can get the pre built release which includes both adb and scrcpy from  here . Linux: Install the packages android-tools and scrcpy using your distro's package manager, there's also a snap package. (Debian) sudo apt install android-tools scrcpy (Arch) sudo pacman -S android-tools scrcpy macOS: brew cask install android-platform-tools brew install scrcpy USB Debugging: You can enable USB debugging in the device system settings, under Developer options. Go...

Optimistic Opinion: Microsoft Actually ❤️ Linux?

Image
Any of you who use npm should have received a mail in the last few days and this post is about that. Microsoft has made a lot of progress in between Steve Ballmer's "Linux is a cancer" and Satya Nadella's "Microsoft ♥ Linux" in the Open Source world. Most of what microsoft has been doing recently is very inclusive of OSS. Things from the top of my head include WSL, VS Code, GitHub, Dot Net Core, Powershell and now npm and the list is very long . Although one can argue that Microsoft is doing all this to push it's Azure platform but still getting quality cross platform open source software is always welcome. Hopefully Microsoft will keep the ball rolling in the right direction and we'll hear more good news in the future.