SOGo Groupware database update after yum upgrade is not normally necessary as it merely reduces the number of tables created for a new collection.

How to list all URL's in Redirect chain

This simple utility is extremely useful in detecting bad redirects and loops, specially in big websites. You can also include it in scripts.

wget http://gmail.com 2>&1 | grep Location:

The response, in this case, is:

Location: https://www.google.com/gmail/ [following]
Location: https://mail.google.com/mail/ [following]
Location: https://accounts.google.com/ServiceLogin?service=mail&passive=true&rm=false&continue=https://mail.google.com/mail/&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1# [following]

Pros and Cons of Hosting your own Nameservers

Benefits of hosting your Nameservers

  • Ease of changing hosting providers: Having your own nameservers make it easy when you are changing your hosting providers for two reasons:
    • Zero downtime in switching
    • Minimal change on Domain Register (change Nameserver and Hostname reords only)
    • Other nameserver changes can be done easily with your own nameserver, even scripted
  • Vanity Name Servers: Your clients may, particularly if you are in reseller business, check your Domain records including your name servers in a bid to identify your genuineness and commitment.
  • Ease of managing nameserver: You can easily script it or use User interface of your choice.

Disadvantages of hosting your own nameservers

  • Need Knowledge: You need to understand DNS well and be conversant in managing nameservers.  Messing up DNS records while client is shouting is not a good experience to have
  • Responsible for Security: You need to ensure that the Nameserver Software is always updated and protect it against all DNS attack vectors
  • Responsible for performance: If you are using the server for other purposes, most likely you are, then your nameserver performance is dependent on the load of the system. When your system is overloaded, havinbg the namserver also slow down adds to the load and more importantly aggravates the problem. You need to ensure performance of your namservers
  • Responsible for redundancy: There should be at least two namservers for redundancy and failover. Unless you have multiple servers that you can use, you are removing redundancy by pointing both the nameseerver IP at the same server.

Domain name registrars nowadays provide free DNS services to better retain their clients by:

  • making it harder to switch
  • giving better value for money

I have done both and I find using Domain registrars service gives less headache but is harder to configure and boring when you have large number of domains.

OVH: How to add Additional IP Addresses (IP Alias) on Ubuntu 16.04 / 18.04

Adding additional IP addresses in OVH is rather unconventional and the guide they point to in their mail is non-existent. The process, fortunately, is simple:

  1. ssh to the server as root
  2. cd /etc/systemd/network/
  3. vi *-default.network
  4. Add the new IP address after the original IPv4 Address
    DHCP=no
    Address=Main_IP/24
    Address=Failover_IP/32
  5. Save and close the file
  6. Reboot the server

You should now be able to ssh to the server using the new IP Address (which OVH likes to call Failover IP Address) in addition to the old one.
Repeat the process for any additional IP addresses.
Note: I have tested it on two different OVH Servers (in France & Canada) for Ubuntu 16.04 and Ubuntu 18.04.

Chrome: How to view YouTube at 3x Speed

When viewing a YouTube video you may want to quickly skip through introductory section or boring/repetitive parts. The following solution will allow you to toggle between high speed and normal viewing. 3x speed-up is not offered by YouTube. With little practice you can understand even at that high speed, you need to be a bit focussed. May help increase your power of concentration.
Drag this link to your bookmarks toolbar: 3x
The bookmarklet is a toggle. Click once to view the video at 3x speed, click again to switch to normal mode.

LXD: How to easily apt update and upgrade all running LXD containers

It is easy to create large number of LXD / LXC containers as it consumes minimal resources. Coupled with btrfs, it consumes minimal hard-disk space also due to de-duplication built-in within btrfs file system. Soon you would find yourself spending a significant amount of time updating (sudo apt update) and upgrading (sudo apt -y upgrade) all these containers (don’t forget: sudo apt -y autoremove). Here is a simple bash-fu magic which you can run from host to update all the containers:
lxc -c ns --format csv ls|grep RUNNING|cut -f1 -d',' | xargs -I'{}' sh -c "echo Updating '{}';lxc exec '{}' -- apt -qq update;lxc exec '{}' -- apt -qq -y upgrade;lxc exec '{}' -- apt -qq -y autoremove"
The code has been tested on Ubuntu 16.04 but it is expected to work on any Ubuntu system starting from 16.04. For previous version(s) use apt-get instead of apt.

Grails: Validating User Domain class

Grails provides support for validating fields. Here is a typical User class with field validation. It ensure that email address & url is of proper format, login is unique and password is not openly displayed.

package com.taragana
class User {
    String login
    String password
    String email
    String url
    static constraints = {
        login unique: true
        password password: true
        email email: true
        url url: true
    }
}

Ubuntu: How to install Oracle JDK 8 with apt get

Oracle JDK can be easily installed in Ubuntu using apt. Using apt simplifies the job of updating the JDK from time to time.
To install Oracle JDK 8

sudo apt update
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer

 

Script to kill all GradleDaemon processes – gkill

GradleDaemon sometimes redundantly runs in the background and Grails gives erroneous responses. The simplest solution is to kill all the errant GradleDaemon processes and run the app again. Below is a simple script which will run all the errant GradleDaemon processes. The same can be used for killing any processes like say Firefox. Just substitute GradleDaemon with firefox.

# Kills all GradleDaemon processes without mercy
ps -Aeo pid,command|awk '{$1=$1;print}'|grep -v grep|grep GradleDaemon|xargs kill -9

Jeff Bezos: 3 questions to ask interviewers after interview for effective hiring

20 years ago to ensure that Amazon would retain high standards as it grew, Jeff Bezos outlined a simple, three-question test for hiring new employees in his 1998 letter to shareholders, a year after the online bookseller went public.
“It would be impossible to produce results in an environment as dynamic as the Internet without extraordinary people,” Bezos wrote of Amazon’s workforce, which in three years had ballooned to 2,100 people. “Setting the bar high in our approach to hiring has been, and will continue to be, the single most important element of Amazon.com’s success.”
The three crucial questions are:
1. “Will you admire this person?”
First, Bezos encourages Amazon recruiters to think about their personal opinion of the candidate.
“I’ve always tried hard to work only with people I admire, and I encourage folks here to be just as demanding,” Bezos writes. “If you think about the people you’ve admired in your life, they are probably people you’ve been able to learn from or take an example from.”
Facebook CEO Mark Zuckerberg also advocates for hiring people whom you respect. “I always tell people that you should only hire people to be on your team if you would work for them”.
2. “Will this person raise the average level of effectiveness of the group they’re entering?”
With this question, Bezos is aiming to get a sense of a person’s capacity for innovation.
“We want to fight entropy,” Bezos writes in the 1998 shareholder letter. “The bar has to continuously go up. I ask people to visualize the company 5 years from now. At that point, each of us should look around and say, ‘The standards are so high now — boy, I’m glad I got in when I did!'”
“Leaders have relentlessly high standards,” according to Amazon’s statement of its 14 driving principles. “Many people may think these standards are unreasonably high. Leaders are continually raising the bar and drive their teams to deliver high quality products, services and processes.”
To ensure that it is hiring the best and brightest, Amazon even appoints a group of its current employees as “bar raisers.” On top of their day jobs in various sectors of the company, these employees are tasked with providing additional perspective on new hires around culture fit and talent.
3. “Along what dimension might this person be a superstar?”
It’s equally important to consider a candidate’s individual talents, according to Bezos.
“Many people have unique skills, interests, and perspectives that enrich the work environment for all of us. It’s often something that’s not even related to their jobs,” he writes in the 1998 letter, citing at the time his excitement about having hired a National Spelling Bee champion.
Bringing a unique perspective to work is another of Amazon’s 14 principles. “Leaders create and communicate a bold direction that inspires results,” according to the company. “They think differently and look around corners for ways to serve customers.”
Source: CNBC