Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
614 lines (482 sloc) 25.4 KB


#100DaysofLinux Challenge

If you want cheer me along follow me on twitter or buy me a coffee ☕

Day 1 of 100: 05/22/2019

Adding SSH keys to Github and Gitlab

I got tired of having to enter my Github or Gitlab credentials every single time I made a push to my remote repos. So I decided create some SSH keys and add them so I can authenticate that way instead.

Turns out it’s actually really easy to authenticate with SSH keys. Both Github and Gitlab have great documentation on how to do this. I will leave links in the “links” section. So let’s see how Github does it.

Adding SSH keys to Github

  1. Generate a new key ssh-keygen -t rsa -b 4096 -C " enter you email in the email portion.
  2. You will be prompted to “Enter a file in which to save the key…”. Simply hit [ENTER] if you want the default else give the file a specific name. In my case I gave it a specific name since I will be have a key for Gitlab as well.
  3. Next you will be prompted for passphrase. Enter a good one and remember to save in your password manager or somewhere safe.
  4. Now copy the contents of you ssh public key to your clipboard. There a bunch of ways of doing this so chose the easiest for you. REMEMBER COPY THE PUBLIC KEY!! I did it like this… cat ~/.ssh/
  5. Go to your Github Settings page and find the section on SSH keys. Click on “New SSH Key” and paste the contents of your public SSH key into the text box.
  6. Click on “Add SSH key” to confirm the changes.
  7. Test if the key works with ssh -T If you are prompted with the usual SSH Authentication message then you know you did things correctly.
  8. Confirm the SSH Authentication and you should be prompted with a message that reads

    Hi yourUsername! You’ve successfully authenticated, but GitHub does not provide shell access.

And that’s it! You’ve successfully added you SSH key to Github. Now when I push a commit to Github I’m not bothered to enter my credentials.


Notes: Adding SSH keys is basically the same for Gitlab. You can follow along with the link I provided if you need more guidance.

Day 2 of 100: 05/23/2019

Manage a Gitlab and Github account on one computer

So after adding my SSH keys to Gitlab and Github I needed a way to tell my local git configurations when and how to use them. This is not that complicated but it is a bit of work to setup and is not fully automated. You will have to configure your SSH config and setup some bash aliases. There are plenty of other ways to do this but this works for me.

Once you have your SSH keys setup for Gitlab and Github it’s time to edit your SSH config to use them accordingly.

  1. Edit your SSH config with your favorite editor.
  2. Below is an example of my config, edit yours to fit your setup.
# Github Account
     PreferredAuthentication publickey
     IdentityFile ~/.ssh/githubPublickeyFile

# Gitlab Account
     PreferredAuthentication publickey
     IdentityFile ~/.ssh/gitlabPublickeyFile

Now you have to manually tell git to configure your per project. In order to do this you have to setup some bash aliases.

  1. Setup an aliases for Github and Gitlab
alias gh='git config'
alias gl='git config'

In this example I setup alias gh as my alias for Github and alias gl for Gitlab. You can name your aliases whatever you chose, also remember to set the correct email for Github or Gitlab. Also if you want, you can set in your .gitconfig a default configuration just in case you forget to run these aliases in your project folders.

Pro tip: If you need to change your for a giving project simply use git commit --amend --reset-author

And that’s it! You now have 2 SSH keys for Github and Gitlab and your system can find the correct keys depending on the project.


Notes: If you are using a different shell then setup aliases that work in that shell.

Day 3 of 100: 05/24/2019

Changing a Git project Remote URL

So the past 2 days I’ve setup SSH keys to authenticate with Github and Gitlab. The only problem was I needed to update my local cloned repos to use SSH authentication instead of HTTPS. This is an easy task and can be done on a per repo basis.

In order to change the remote url’s you will have to go into the local directory of your project in the terminal. Check the remote url of the project with this command git remote -v. Here’s the difference between HTTPS and SSH remote urls.


origin (fetch)
origin (push)


origin (fetch)
origin (push)

Here’s how to change a remote from HTTPS to SSH git remote set-url origin

And that’s it! With this little trick you can easily switch between HTTPS and SSH for your remote URL’s



Day 4 of 100: 5/27/2019

Sign Git commits with a GPG/PGP key

Continuing with my work on understanding Git, I wanted to add a GPG key to my Gitlab account. I want sign my commits so they are verified by me. Doing so is not so hard and only takes a few minutes. As a bonus I’m going to use the PGP key created in my Keybase account.

Let’s get started by making sure we have Keybase ang GPG installed. You should follow the instructions to install Keybase or GPG for your OS. Both apps are available in Linux, MacOS, and Windows. Once both are installed you can begin importing the PGP key to you system. I’m on Ubuntu 18.04 so these command are for most Linux systems.

  • Import the Public Key keybase pgp export | gpg --import
  • Export the Private Key keybase pgp export -s | gpg --allow-secret-key-import --import

During the second command you will prompted to create a passphrase. This is done so your local GPG system can add extra security to your GPG keys. This passphrase is for your local keyring, be sure to save it in your password manager.

Now you will need to print out the contents of your Public key so you can add it to Gitlab. If you are using Keybase simply check your public profile for your Public Key. Else you can use the following commands to get your Public key.

  • If you want to save it to a TXT file gpg --armor --export > userPublicKey.txt
  • If you want to print it out on the terminal cat | gpg --armor --export

Next you will add the Public key to your Gitlab account. In Gitlab go to your user settings > GPG keys > Add a GPG key.

Here you will be promted with a text box to enter your Public key. Simply copy and paste the contents of you Public key and your done! Well almost…you need to tell your local Git to use the GPG key to sign commits.

  • Add the key to your global user settings gpg config --global user.signingkey KEYID <- KEYID is of your GPG key pair
  • Tell git to prompt for commit signing gpg config --global commit.gpgsign true

And that’s it!


Notes: If you don’t have a Keybase account, simply create a GPG key pair on your system.

Day 5 of 100: 5/28/2019

Encrypting your data with LUKS

Learning to encrypt your hard drive is very important in the security space. Not only is it a good idea to encrypt but it’s very easy to do so. So I did some research and found a good way to get started with encrypting your hard drive with LUKS.

  1. Let’s get started by installing LUKS on Ubuntu 18.04

sudo apt install cryptsetup

It’s helpful to know what partitions are on your system. Simply use the command lsblk to do so.

  1. Now is time to encrypt a partition

sudo cryptsetup --verbose --verify-passphrase luksFormat /dev/sdbX

  • where X is the number of partition, unless there’s only a single partition
  • You will also be promted to enter a passphrase, be sure to make it a strong one and to save it in your password manager.
  1. Open the encrypted partition so you can work with it

sudo cryptsetup luksOpen /dev/sdbX sdbX

  1. If this is a new hard drive you will need to create a filesystem on that partition

sudo mkfs.ext4 /dev/mapper/sdbX

Now you are done with creating an encrypted partition. Let’s see if we can save files to the partition.

  1. Create a new empty directory in the encrypted partition

sudo mkdir /mnt/secure sudo mount /dev/mapper/sdbX /mnt/secure

  1. Create a text file in that new directory

sudo touch /mnt/secure/test.txt

  1. (Optional) You can change the permissions in this encrypted partition so your regular system user can access it without Sudo privildeges.

sudo chown -R `whoami`:users /mnt/secure

  • Test permissions by creating an empty file without sudo permissions touch /mnt/secure/test2.txt if this worked, then you can create and move files into the partition without the need for sudo privildeges.

Let’s unmount the partition and make sure LUKS closes the encrypted partititon.

  1. Unmount the partition sudo unmount /dev/mapper/sdbX
  2. Close the encrypted partition sudo cryptsetup luksClose sdbX

And that’s it!



Day 6 of 100: 5/29/2019

Adding Github Badges in Org files

Github uses Markdown as it’s syntax styling for any regular documents. So when you are creating your README files or LICENSE files writing them in markdown allows Github to automatically format them. But for this challenge I’m using Emacs + Org-mode. Org is another great text based syntax and Org-mode is simply too amazing to try to explain here.

The problem is that Org is not Markdown so Github renders it slightly differently. The cool thing about Org-mode is it’s exporting functions which export to Markdown. But I wanted to keep all of my notes and Log in Org syntax. So I ran into a small issue when I wanted to add a Github Badge to my org file.

Github Badges are primarily written in markdown. I did some research and I couldn’t find much info on how to add markdown badges in org files. You could do multiple things, like use the export function. Or you could use the src block feauture and add the badge as an HTML snippet.

I did a quick little test and found that I could simply redo the markdown format in org format and the badge works! But I was reminded by a reddit post that MELPA shows you badges in all three formats. So I felt a little silly for overthinking this problem. But luckily I was able to find a solution. Below is an example of a Badge in Markdown syntax and another example in Org syntax.

  • In Markdown syntax


  • In Org Syntax


  • Actual Badge

The formats look similar but are quite different. I also found out via the reddi that you can use Macros in an Org file to basically add these badges as well. But I’ve had limited success with this. I’ll have to do a bit more research to get this working. In the end I was able to figure it out another way. And now I can show badges in org files. And that’s it!



  • If you feel awesome 👍 you can keep me going and buy me a coffee ☕ Thanks!

Day 7 of 100: 5/30/2019

My Emacs Setup

I use Emacs as my all around text editor and it is extremely powerful. Before I began using Emacs I was jumping back and forth between Vim, Gedit, and Kwrite. All of those text editors are great but Emacs has features that just blew me away.

One of those features is an amazing package called Org-mode. Org-mode is system for organizing and formating notes. But Org-mode is much more because it’s functionality includes a Word Processor, Calendar, Agenda, and document exporter.

You combine that with other Emacs packages like Magit or org2blog you got one awesome text editor. Basically I use Emacs for writing my notes, managing my Github/Gitlab remote repos, and blogging in Wordpress. Emacs is totally awesome but it has a very steep learning curve. To make the learning curve a bit easier I use an Emacs configuration called Doom!

Doom is great and most importantly it’s FAST! With Doom you have Evil-mode which adds the Vim keybinding to Emacs. Doom basically makes using Emacs easier and includes a bunch of amazing goodies. So I’d like to show you how to install it (in Ubuntu 18.04) so you can give it a try.

  • Install Emacs 26+

sudo add-apt-repository ppa:kelleyk/emacs

sudo apt update

sudo apt install emacs26

  • Run Emacs once before installing Doom


  • Clone Doom Emacs Config

git clone ~/.emacs.d

  • Install Doom

cd .emacs.d/bin

doom quickstart

  • Run Emacs again and you should be prompted with Doom

So now you have a Doom Emacs installed and you can get started with managing remote git repos with Magit or start writing Org documents. Check out the Doom Github page for info on what else Doom is capable of. And that’s it!



  • If you feel awesome 👍 you can keep me going and buy me a coffee ☕ Thanks!

Day 8 of 100: 6/4/2019

Convert OVA to QCOW2 format

When working with virtual machine file formats you have several different options. OVA is a common one but not one that is easily supported with KVM. So how do get around this issue? Simple, convert it to QCOW2 format. Let’s see just how easy it is in Ubuntu 18.04.

  • Install QEMU-Utils

sudo apt-get install qemu-utils

  • Now extract your OVA image

tar -xvf VMexampleimage.ova

This step will result in 2 extracted files. You will either have a VMDK or VDI file along with an OVF file. You will either use the VDI or VMDK file to convert into a QCOW2 file.

  • Convert a VDI to QCOW2

qemu-img convert -O qcow2 input.vdi output.qcow2

  • Convert a VMDK to QCOW2

qemu-img convert -O qcow2 input.vmdk output.qcow2

Now you have a QCOW2 that can be easily used in KVM. Plus QCOW2 is also a widely supported format so many popular hypervisors support it. And that’s it!



Day 9 of 100: 6/7/2019

Git Superpowers

I’ve been trying to sharpen my Git skills because Git is an amazing technology. But it can be tricky to learn and practice using Git is definetly needed. So I started to research tutorials and I found a few good resources.

Here’s a site called Oh shit, git!. Yes, that’s the name of the site and it’s full of amazing examples. Most importantly it shows some of the common ways you can mess up using Git. Then it shows you in plain “English” how to fix the error. I recommend this site for the laugh factor alone and that it can save your life one day (at least your work day 🙏).



Day 10 of 100: 6/10/2019

Emacs Troubleshooting

I’ve been trying to learn the ins and outs of Emacs lately. I use Doom Emacs as my text editor for most things. But one of the things I like use it for is posting to my Wordpress blogs. To accomplish this I setup a package called org2blog. This package allows me to post directly to Wordpress blog from Emacs using Org files as my posts.

So I can keep local copies of my blog posts in Org files and post directly to my various blogs from Emacs. It’s a win, win for me. But there are some drawbacks, I think with the version I’m running it has some issues with the auth-sources api. It can read the authinfo.gpg file but I have to run auth-source-forget-all-cached and then doom-reload before I can successfully log into my blogs.

I’m still troubleshooting the problem to see if I can figure out the isssue, but it seems others have expressed frustration with auth-sources. Maybe I’ll try to use Pass as an alternative. Anyways that’s it for now!



Day 11 of 100: 6/11/2019

Installing Nextcloud

I installed Nextcloud on a VPS with cPanel installed. This is not the usual way of installting Nextcloud but it sure does make it easier. cPanel allows you to work with MySQL databases and files on your server easily. As long as you have some working knowledge of sever managment you can learn cPanel.

So I wrote up a blog post about my process of installing Nextcloud. You can view the post here. It’s not full tutorial because every VPS environment is different, so your milelage may vary. But you can most of the way if not fully there with my tutorial. And that’s it!



Day 12 of 100: 6/17/2019

Command Line Basics

I did a presentation for the South Texas Linux User Group on Command Line Basics. I covered 7 basic commands that I feel every new user should know. So below are the 7 commands every new Linux user should master.

  1. pwd: Print Working Directory
  2. cd: Change Directory
  3. mv: Move (Files or Directories)
  4. ls: List (Files or Directories)
  5. cp: Copy
  6. rm: Remove
  7. df: Disk Filesystem

I recommend you check out the manual pages for each of these commands if you are new to Linux. But overall these are 7 good commands to start with. And that’s it!



Day 13 of 100: 6/20/2019

Working with Org-Mode in TXT files

So I came across an interesting problem that had a very easy solution. Thanks to Org-mode being so robust the answer was so easy it only required one line of text. My issue was this, inside of Nextcloud online editor for “Notes”, it only is able to parse .md or .txt files. I work with .org files with my Org/Emacs setup. So Nextloud could not open the .org files, it just prompted an error.

I needed to find solution so I open and Org file in Nextcloud or at least have Nextcloud recognize it was a simple TXT file. The answer was to simply add the following line to the top of my file.

-*- mode: org; -*-

This one line at the top of my file allows Org/Emacs to read the file as an Org-mode file. Now I simply work in a file as I normally would and export out to .txt with org-export. Nextloud can read the .txt file though it doesn’t properly format the file in Org but that’s ok. And that’s it!



Day 14 of 100: 6/21/2019

Create Snippets in Emacs

Emacs Snippets are awesome and they can save you hours of time. To get snippets working in Emacs you have to have the package Yasnippet. After you set that up you can start creating snippets.

But what is a snippet exactly? And why is it useful? Have you ever used text expanding function in a document editor? If yes, then yasnippet works basically the same way. If not, text expanding is basically a method of adding a block of specific text via a hotkey or key combination. So say you type a specific sentence a lot and don’t want to retype it. You can setup a yasnippet and with a keyboard command you can simply let emacs type it for your.

So here’s how you can add a snippet in Emacs.

  1. Call yasnippet in Emacs.
  2. Use yas-new-snippet
  3. Enter a Name and Key. “Name” is what the snippet will be called, “Key” is what it will appear as in the buffer.
  4. Add the content that you want copied in the text area.
  5. Save snippet
  6. Use SPC i s (in Doom Emacs) and insert the snippet

As you can see this can be a super useful function. I’m using it to create a new log entry for this challenge. So I don’t have to retype the template I simply use snippets to add a new entry. And that’s it!



Day 15 of 100: 6/21/2019

Adding Org Capture Templates in Emacs

So Org Capture is another amazing feature in Org-mode. Basically Org Capture let’s you quickly capture bits of information in various locations. Say you needed to add a note to your daily work journal well Org Capture can do that for you easily. Let’s see how add a capture template in Emacs.

First you’ll have to setup some configurations in your init.el (or config.el in my case). Below are some basic configurations but yours may differ.

(setq org-directory "~/Org/"
        org-agenda-files (list "~/Org/")
        org-capture-todo-file "~/Org/"
        org-capture-notes-file "~/Org/"
        '(("t" "Todo" entry (file+headline "" "Tasks")
              "*TODO %?\n  %i\n")
          ("n" "Note" entry (file+headline "" "Notes")(file "~/emacs.d/templates/notes.orgcaptmpl"))

You can setup the template directly in the configuration or you can setup a template file which Org Capture can read from. Here’s an example of my template file for capturing a note.

 * %^{Name} captured %U
%^{Note Type|note|quote|one-liner|code}

Once you setup all of these configurations you can simply call Org Capture with Mx: Org-Capture and chose the appropriate capture. And that’s it!



Day 16 of 100: 6/24/2019

Simple Steps to Stop Spam Emails

I came across some spam issues that a client was having. Basically they simply were getting various forms of spam emails. Some included phishing and malware emails that were automatically detected by their email provider.

But there is still a few more strategies we can implement to help deter spam for not just my client but for everyone. So let’s see 2 of these strategies.

  • Reporting suspicious URL’s to Google

You can go to the following address and submit a suspicious URL to Google. They’ll analyze it, and if it meets the requirements for a phishing site it will block it in Chrome.

  • Report Domains to Domain Registrars

Sometimes a domain gets taken over or a spammer buys them in bulk to setup spamming operations. Alerting Domain Name registrars that a domain is being used for spamming will get the domain taken down, garanteeing that the domain account is suspended.

Run whois on the Domain, here you will find a bunch of information on regarding the domain. But you’ll want to look for the registrar info and if they have a link or email to which you can send them an “abuse” report. This is an easy process and takes no time.

These two simple steps can help in curbing email spamming. Plus it may help save the day of another internet citizen. And that’s it!



Day 17 of 100: 6/25/2019

Create a Windows 10 Boot USB Drive

As it turns out I actually needed to create a Windows 10 USB Boot drive today! Funny thing is that I didn’t have a spare Windows 10 computer do download the official Windows Media Creation Tool. Luckily there’s always a way to get around Windows stuff with Linux!

I found out that if you simply mount the Windows 10 iso file it has all the files you need to create a USB Boot drive. So let’s see just how easy it is to create a Windows 10 Boot drive in Ubuntu 18.04.

  1. Downloads a legal copy of Windows 10 here.
  2. Go to where you downloaded the Windows 10 ISO file.
  3. Right click on the iso file and chose to mount it in Disk Image Mounter
  4. Once the iso is mounted simply go to the directory containing all the Windows 10 files.
  5. Copy over all the files from the mounted Windows 10 iso to a blank USB drive. Be sure the USB drive is at least 16GB and is either GPT or MBR
  6. Once you have everything copied over to the blank USB you should have a bootable Windows 10 USB.
  7. Test if the USB drive boots into Windows 10.

It’s that easy to create a Windows 10 USB drive in Linux. And that’s it!



You can’t perform that action at this time.