Oct 2, 2017

HP Chromebook 11 G1/G2 Performance Fixes

One of the problems with this laptop, has always been performance. There are various issues on ChromeOS, some which can be mitigated:
  • Bugged thermal governor script - drops CPU to 700MHz constantly.
  • Compressed swap slows down the CPU, while ChromeOS does a great handling of out of memory conditions.
  • 1080p60 video support only for H.264, which is not the default codec on Youtube.
Both the software issues can be solved by running a 'tweaks' script and then a replacement 'thermal' script that gracefully drops clocks as it the CPU heats up - these are available on my Github repo.
You need to do this on a console after the system boots, due to read only root filesystem.

Without swap you will get more tabs killed but the behaviour is mostly excellent as long as you reboot every couple days to clean memory leaks. When using ZSWAP, it will be pushing the CPU constantly and slow downs are plenty.

For Youtube, you need to use the h264ify plugin but this will only work when you open Youtube directly - the plugin can't access data from other websites, rightfully so. This way the hardware decoder is used and it can play video smoothly.

Still, the system is a bit slow for some tasks. My experience installing Arch Linux is much faster, as it also uses much less RAM. This is a lot harder and is work in progress but using Firefox 55 is faster than the current Chromium builds - both on benchmarks and real scenarios.

HP Chromebook 11 G1/G2 Repairs


I have tested and recommend the following replacement hardware for charging problems:

Sep 1, 2016

MySQL - Root Password Reset

To reset the MySQL root password, we need to start MySQL in safe mode. Type in the console:

sudo service mysqld stop
sudo mysqld_safe --skip-grant-tables &
mysql -u root mysql

Then you'll be on the MySQL prompt where you should define the new password:

UPDATE user SET password=PASSWORD("abcd") WHERE user="root";

After this you should have dropped to the Linux console again, where you need to restart the service to enable the grant tables again:

sudo killall mysqld_safe
ps ax | grep mysqld # Is it gone?
sudo service mysqld start
mysql -u root -p mysql


Tested on:
  • Gentoo Linux
  • Red Hat Enterprise Linux 5/6/7

Sep 13, 2014

Quality VPS Server Providers

Last updated: October, 2017

A Root Server or, most commonly, a root virtual private server (VPS) is typically a Linux or Windows based server where you have full control over the operating system.
I take a look at three providers:


At this time, I have dropped Hetzner's services due to drops in performance in new VPS products. I have changed providers to Vultr and have been much happier ever since.
Scaleway is interesting but I have experienced data center issues, among others, so don't recommend them for anything critical.

General Tips

The use of good virtualization software is the first and most important feature of a quality root server, as OpenVZ/Virtuozzo (operating system level virtualization) allows oversubscribing that delivers both lower prices and terrible performance (most of the time). You also can't use swap with OpenVZ, so that doesn't leave a lot of margin for error in the server's configuration for periods of high load. I recommend you to stay away from OpenVZ for these reasons.

KVM and Xen solutions do not allow oversubscribing and deliver much more consistent performance, albeit peak is lower.

Other requirements matched for these providers:
  • No contract termination for full resource usage (CPU, disk).
  • Offline console.
  • Custom ISO install (Vultr).



This German based provider offers not only root servers of the VPS variety but also dedicated servers, web hosting and collocation services. I have used the VQ7 VPS service, which had the following characteristics:
  • 1 Virtual CPU
  • 512 MiB of RAM
  • 25 GB of HDD space
  • 2 TB of traffic
  • KVM Virtualization
  • Full root access
Hetzner not only provides the offline console but also a Linux rescue system, which then lets you install any distribution or lets you recover the machine from any state.  Offline consoles are especially important if the providers don't have 24/7 support or any kind of management of the instances, as is the case with Hetzner. If you need 24/7 support, you need to contract one of their more expensive root server offerings, which start at €50/$69. Support has always been helpful and problems were with ease.

Hetzner has, in the last few years, upgrade to "CX" plans that have better hardware and a network SSD for disk space. My benchmarks of these machines have been very underwhelming, with incosistent performance on both the I/O and processing. Equivalent plans benchmarked much lower than VQ plans and are generally uninteresting compared to other offers.


A more nimble member of the Online.net french server provider, it has come to market with the very cheap C1 dedicated ARM server. They have been expanding and now offer more powerful ARMv8 servers (up to 64 cores w/ 128GB of RAM) and x86-64 offers of both virtual and dedicated variety.

Always interesting to test software, deploying servers is easy and the online panel is great, as is the pricing. Downsides have been insecure systems that transfer kernel modules unencrypted over network connections and I've experienced network issues with no notice issued.

I wouldn't use them, right now, for anything critical but they may be interesting for testing software or ARMv8 servers.


Offering two types of servers over 15 datacenters spread worldwide, Vultr is not the cheapest provider but offers several features many don't:
  • Free disk snapshots.
  • Custom ISO installs.
  • High quality, low latency VNC client over the browser.
  • Network disk add-ons on high redundancy hardware (Block Storage), on the NJ datacenter.
Plans start at $2.50 for VC2 instances, matching most of the competitors, and price doesn't change with datacenter location.
Performance has been great and the control panel is clearly among the best out there.
Windows Server options are also available at a reasonable price, so pretty much anything you need should be covered by Vultr.

May 9, 2014

NGINX - Performance Tuning

Naked Domain Redirect

On most situations, one can use this code to redirect to the www sub-domain:

server {
    if ( $host !~* ^www\. )
        rewrite ^(.*)$ http://www.domain.com$1;

This has performance issues since NGINX has to evaluate the IF block for every request. Instead, you can use server blocks perform a HTTP 301 redirect:

server {
    server_name domain.com;
    return 301 http://www.domain.com$request_uri;

server {
    server_name www.domain.com;


Apr 28, 2014

Linux Kernel - Forcing a Crash

In software development, it is sometimes important to have resiliency to crashes in the software. It is less impractical though, to induce a crash in a remote machine, which may not be easily power cycled. For this purpose, the Magic SysRq Linux kernel functionality can be tapped into:

echo "b" > /proc/sysrq-trigger # Emulates a crash

The most relevant options, from the Linux kernel manual:
  • b - Reboots the kernel without first unmounting file systems or syncing disks attached to the system.
  • c - Crashes the system without first unmounting file systems or syncing disks attached to the system.
  • o - Shuts off the system.

Sep 8, 2011

Bash - String Tokenizing

Bash has some functionality to enable building a string tokenizer, by means of four modifiers:
  • #
  • ##
  • %
  • %%
We can then use to to get the first or last elements, from the end or the start of the string:

echo ${TEST#*/}
echo ${TEST##*/}
echo ${TEST%/*}
echo ${TEST%%/*}

# am/a/very/big/dir
# dir
# i/am/a/very/big
# i

echo ${TEST#*/*/}
echo ${TEST%/*/*}

# a/very/big/dir
# i/am/a/very

I have omitted a leading slash in this string, which was a directory, so that it would print "i" instead of nothing. So you can use echo ${TEST%%/*}  to get the first element and saving echo ${TEST#*/} on every iteration of a cycle that tokenizes the string into an array.

The last two expressions serve to show that if you're dealing with some hardcoded delimiters, you can further expand it so that it matches what you want precisely.