Category: Linux

0

Making Ubuntu (Gnome) more macOS-like

At my new job, I’m once again forced to use a macOS machine for development.

As a result of that, whenever the week is over and I go back to my Ubuntu machine I find that my brain keeps messing up the shortcuts I’ve spent decades learning.

At first, I tried to solve the problem by using karabiner on macOS to make the shortcuts more Windows/Linuxy. This was never perfect since, for example, making ctrl+c copy… makes it unable to kill processes in terminals.

I then decided to give the macOS shortcuts a chance… and it turns out that they are pretty sensible. Using the thumb to copy and paste instead of the pinky just…. feels better. So instead I’ve decided to make my Ubuntu shortcuts more macOS-like…. here are the main steps:

  1. Install gnome-tweaks then navigate to “Keyboard and mouse > Additional Layout Options > Alt and Win behaviour” and select “Ctrl is mapped to Alt, Alt to Win”. This will make most shortcuts work with the thumb but we’ll now need to fix a few things.

  2. The launcher. The Win key will no longer work but we have the shortcut for spotlight memorized so we can use that. For this, I went with albert https://albertlauncher.github.io/. It also has the benefits of being able to do cool things like math and terminal commands right there in the popup.

  3. Window Switching. Navigate to “Settings > Keyboard > View and customize shortcuts > Navigation” and set ‘Switch Applications’ to Ctrl + Tab

That’s about it, hope I helped.

0

How to install Ubuntu Yaru theme in Pop!_OS 20.04

TL:DR

sudo apt install yaru-theme-gnome-shell yaru-theme-gtk yaru-theme-icon yaru-theme-sound

Long Version

To search for a package in apt you can use the command sudo apt search searchterm. Using this command you get the following result:

(more…)

0

NodeFerret – Free Server and Uptime monitoring

Disclaimer
I am the creator of NodeFerret, as a result I will be biased towards it. With that said, let us begin.

So what is NodeFerret?
At a high level NodeFerret aims to be a Linux Server and Uptime monitoring tool. It continuously checks your website(s) and/or server(s) and notifies you (eMail, Slack, Webhook) if anything goes wrong.

You mentioned the word free… much does it really cost?
Well the ‘official’ pricing is on the website https://nodeferret.com/#pricing but for the general hobbyist or indie developer use it’s essentially free.

How can you sustain it while having it ‘essentially free’?
I initially created NodeFerret for myself. To monitor various sites and servers I have online.

After I was done I realized that I had so much extra resources that I could have 1000 more me’s using the service and not have to pay an extra dollar…. so here we are.

Why would I use NodeFerret over say, NewRelic or DataDog?
If you need the level of insight into your servers or applications that these providers provide then NodeFerret probably isn’t right for you.

We are focused on the average developer or sysadmin who wants something easy to use and ‘just works’, Not the DevOps Engineer with a fleet of containers and a full-time job caring for them.

Sounds interesting, where can I sign up?
Right over there –> https://console.nodeferret.com/register

What if I have problems?
You can leave a message on the nodeferret community forum.
Or email me directly at support[@]nodeferret.com

Final Words
I do hope you enjoy using NodeFerret as much as I enjoyed creating it. I am always adding new features and trying to make it a better tool for everyone.

0

Linux (Ubuntu) commands to memorize

This is just a personal reminder of commands that I use a lot that I should really memorize but haven’t gotten around to.

How to check what is running on a particular port

lsof -i :8000
0

Rancher 2.0 etcd disaster recovery

This doc shows how to restore to a single node etcd cluster after a 3, 5 or 7 node cluster has lost quorum.

Ideally with these sorts of failures you want to try your best to get the original etcd hosts back up.

This is also done at your own risk, I have no association with Rancher nor am I a Rancher professional. It is also highly recommended to test this in a staging environment first. I will NOT be responsible for the loss of all your or your company’s data; which is exactly what will happen if this procedure fails.

With that out of the way; please read on.

This doc assumes you have
1. rancher_cli installed on your local machine
2. a working internet connection on the surviving etcd host

1. Login to the surviving host

rancher context switch
rancher ssh <surviving_etcd>

At this point you may want to do a docker inspect etcd to ensure the the following two directories are bind-mounted

...
        "Mounts": [
            {
                "Type": "bind",
                "Source": "/var/lib/etcd",
                "Destination": "/var/lib/rancher/etcd",
                "Mode": "z",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/etc/kubernetes",
                "Destination": "/etc/kubernetes",
                "Mode": "z",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

If you do not see the above.. Stop.

2. check the health of the cluster

docker exec -it etcd etcdctl member list
docker exec -it etcd etcdctl endpoint health

You should see unhealthy cluster

3. Take a snapshot of cluster

This ensures that if for any reason this operation fails, you have not lost all your data. We will store our snapshot in the /etc/kubernetes dir which is bind-mounted onto the same path on the host

mkdir -p /etc/kubernetes/etcd-snapshots/etcd-$(date +%Y%m%d)
docker exec -it etcd etcdctl snapshot save /etc/kubernetes/etcd-snapshots/etcd-$(date +%Y%m%d)/snapshot.db

4. Get deploy command

Lavie (https://github.com/lavie/runlike) has this great tool which approximates the deploy command used to put up a docker container. We will use it to get out etcd configuration. Run the following:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock assaflavie/runlike etcd

the output should be a pretty long docker run type string. Save it in a safe place for later

5. Destroy/Rename the old etcd container

docker stop etcd
docker rename etcd etcd_old

6. Start the new etcd container

  1. Edit the --initial-cluster area of the command from step 4, leaving only the surviving container.
  2. Append --force-new-cluster at the end of the command

Use this new string to deploy a new container.

7. Delete old nodes

In the rancher UI. You should now be able to access your cluster again. Delete the pools of the nodes that died. (This will take a while as rancher will redeploy etcd)

You are now free to continue using your cluster or create new nodes to expand your etcd cluster

END


Extra

In case everything went to hell, we can use the snapshot taken in step 3…

docker exec -it etcd etcdctl snapshot --data-dir=/var/lib/rancher/etcd/snapshot restore /etc/kubernetes/etcd-snapshots/etcd-$(date +%Y%m%d)/snapshot.db

docker stop etcd
mv /var/lib/etcd/member /var/lib/etcd/member_old
mv /var/lib/etcd/snapshot/member /var/lib/etcd/member
rmdir /var/lib/etcd/snapshot
docker start etcd

The above restores the snapshot to /var/lib/rancher/etcd/snapshot
We then stop etcd, archive the messed up etcd data (member_old) and replace it with the restored data

0

Fix: Ubuntu touchpad stops working on wakeup

Create a file in /lib/systemd/system-sleep

sudo vim /lib/systemd/system-sleep/fixmouse.sh

Create a script which will reinstall the psmouse kernel module on wake

#!/bin/sh
case $1/$2 in
  pre/*)
    echo "Going to $2..."
    # Place your pre suspend commands here, or `exit 0` if no pre suspend action required
    exit 0
    ;;
  post/*)
    echo "Waking up from $2..."
    # Place your post suspend (resume) commands here, or `exit 0` if no post suspend action required
    modprobe -r psmouse
    modprobe psmouse
    ;;
esac

Ensure the script is executable

chmod 755 /lib/systemd/system-sleep/fixmouse.sh

Done. Try it out.

0

Ubuntu 18.04 Tools and Apps

This serves to be an ever-changing personal list of what to install if I ever redo my Ubuntu machine. Currently I am running Ubuntu 18.04 so can only guarantee compatibility with that version.

Uncommon

Comfortable Swipehttps://github.com/Hikari9/comfortable-swipe-ubuntu
Lets you map trackpad gestures to just about anything. Also comes with sensible macbook-like defaults

MellowPlayer – https://github.com/ColinDuquesnoy/MellowPlayer
Ever wanted a well integrated linux app for your music player of choice? Deezer? YouTube?
(Note: You will need to install pepperflash)

###Common
Docker
Skype
gnome-tweaks
IntelliJ everything
Visual Studio Code

Extensions

Dash To Dock
Workspace Grid
Sound Input and Output Device chooser

Note: All extensions can either be downloaded from the gnome-extensions site or the integrated software store

Fix: Android emulators not starting in Ubuntu 2

Fix: Android emulators not starting in Ubuntu

Often this happens when for some reason or the other your OpenGL config is broken. This is often an issue on Ubuntu 17.04.

To confirm this is your problem, (Assuming your Android SDK lives in ~/Android/Sdk)

Step 1
Get your emulator’s name:
~/Android/Sdk/emulator/emulator -list-avds

In my case it was Nexus_4_API_25

Step 2
Test running using system OpenGL
~/Android/Sdk/emulator/emulator -avd Nexus_4_API_25 -use-system-libs

If the emulator starts successfully we can make this solution semi-permanent by having a symbolic link in the android Sdk dirs to the system’s openGL

Step 3
cd ~/Android/Sdk/emulator/lib64/libstdc++/
mkdir backup
mv libstdc++.so.6 backup/
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .

Voilà, you should now be able to launch your emulator from android studio or anywhere else. In the case of any future updates, you can just run the above commands again.

 

Source: Martin Revert (stackoverflow)

Best linux distro for daily use in 2017 1

Best linux distro for daily use in 2017

A new year has begun. Time to format my disks. New windows install and more importantly, new Linux install. With windows, the choice is easy. Windows 10. With Linux, it’s a bit more complicated….

Here were the candidates

Ubuntu 16.04 LTS
Here’s a little history about my relationship with Ubuntu. Ubuntu was my first distro and all was right with the world, I would never have left… that is.. until the fire nation att… until unity. It was a bit of a messy breakup, something about it just didn’t resonate with my soul. A year or two ago I tried it again but I remember seeing amazon search results integrated by default and was instantly disgusted. But time has passed, seasons have changed and I believe people learn from their mistakes..so I wanted to give it another shot. so I did… (more…)