Tag: Linux

Hardware Acceleration in Chrome

Hardware Acceleration in Chrome

All work and no play makes Jack a dull boy

Well, as if anybody expected that to only apply to Jack, you can bet your ass it also applies to Mike. That’s right – every now and then Mike needs to take the edge off on some Youtube sh*t (sometimes even for endless hours lost in oblivion) or some damned annoyingly addictive browser game.

But then again, how in f*ck’s name would Mike feel any better about doing so if everything hangs and seems laggy / choppy? He wouldn’t, that’s how. And right about now, he blames it all on Chrome’s hardware acceleration default settings under Linux. Just to make sure, he goes to chrome://gpu/ and witnesses this horrific scene:

chrome-gpu-off

But Mike’s a crazy mothaf*cka – he then just goes straight to chrome://flags/ and enables the override on software rendering, thus enabling GPU acceleration on his apparently unsupported system configuration.

chrome-flags

He now restarts his Chrome, everything works fine and the Gods of Internets smile approvingly. But just before diving into a multiverse of fun, he takes a few short moments wallowing in self-pity, consumed by doubts about nVidia and random homicidal thoughts about Aquaman while checking the chrome://gpu/ page one last time.

chrome-gpu-on

Just to remove any trace of doubt – that green text right there – it makes St. Patrick proud and Chrome run smooth. Mission complete.

Advertisements
How to install LAMP manually in 60 seconds

How to install LAMP manually in 60 seconds

It usually takes me a few good minutes to get the LAMP stack (Linux Apache MySQL PHP) installed and many more to get it configured to fit my needs. Well, I’ve finally managed to get it all together into a little something that can be done in under a minute. Assuming you’re doing this on a reasonably fresh Linux installation, these following lines will get you through with no problems and you’ll be the proud user of Apache 2.4 + PHP 5.6 + MySQL 5.6 in no time:

First, install a mother-load of packages (basically Apache, PHP, MySQL, phpMyAdmin and MySQL Workbench):

sudo apt-get install apache2 mysql-server mysql-workbench php5 curl php5-curl mcrypt php5-mcrypt php5-imagick php5-gd php5-xdebug phpmyadmin

Then, a few useful Apache modules:

sudo a2enmod rewrite headers expires deflate

Yeah… we might get a nasty looking message every time we restart the apache server, something like this:

apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1. Set the ‘ServerName’ directive globally to suppress this message.

To get rid of that, we have to define the ServerName and include it in our configuration file.

httpd.conf

sudo nano /etc/apache2/httpd.conf

This file might be blank, but add the following line to it anyway:

ServerName localhost

Then add these references to the apache2.conf file

apache2.conf

Include httpd.conf
Include /etc/phpmyadmin/apache.conf

Cool, now as a security measure, it would seem that in newer Apache releases, the default document root points to /var/www/html instead of directly to /var/www. We might as well rename that html to public_html and update some configs.

000-default.conf

sudo nano /etc/apache2/sites-available/000-default.conf

And change the DocumentRoot to this:

DocumentRoot /var/www/public_html

Also, while we’re in here we should add a few lines to prevent mod_rewrite from having girl problems later in life:

<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
<Directory /var/www/public_html/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all
</Directory>

Also, there might be some trouble with PHP’s mcrypt extension, so let’s make sure it actually gets loaded:

php.ini

sudo nano /etc/php5/apache2/php.ini

Go down to Dynamic Extensions and add this line if it doesn’t exist:

extension=mcrypt.so

And… that should be it – restart the web server and go to http://localhost/ to test the installation:

sudo service apache2 restart

Also, just for the thrill, you can make a phpinfo.php file in /var/www/public_html with just this:

<?php phpinfo(); ?>

to review all the modules and extensions that have been miraculously installed on your system.

Also, a quick tip on the nano editor if you haven’t moved on to vim already. Tab size should be 4 spaces – that’s it – period. If there’s already a .nanorc file in your home directory, add this line to it or create if first otherwise (dooh~)

set tabsize 4
How to make Linux look sexy in only 3 fast steps

How to make Linux look sexy in only 3 fast steps

I used to be an Ubuntu user, but never really liked Unity much, so every time I installed Ubuntu – I also took the time to install Gnome and try out a whole bunch of themes, icons and extensions and then waste even more time configuring them individually, but no more.

Long story short, with the relatively recent events of HWE going out of support and Ubuntu rolling out SP1 (14.04.1 LTS), I had some major problems with my system so I eventually had to reinstall all of it. (The problems I had and still sort of have will be elaborated in a different post soon as I come up with a unified 100% working solution). It was at this point when I started researching different distros, only to eventually find myself back to square 1.5 as I discovered Ubuntu Gnome thanks to Jeff Turner who had a fairly convincing review of the OS.

Jumping right into it, I installed Ubuntu Gnome 14.04 (no need to thank me for that statement, Captain Obvious knows when he’s being appreciated), then of course I couldn’t boot anymore so I removed silent splash and added nomodset in the GRUB entry and booted with fail-safe graphics, the display was corrupted so I dropped to console (Ctrl + Alt + F1) and purged all nVidia drivers, rebooted in recovery mode and installed nvidia-current drivers and replaced the default xorg.conf file with my magic backup and I was finally there. Recurrent thought: why can’t I ever just skip the details and go with minimal writing as planned?

1. Enable User Themes and install these:

Numix GTK3 Theme: Also available via PPA:

sudo add-apt-repository ppa:numix/ppa
sudo apt-get update && sudo apt-get install numix-gtk-theme

Minimal 3.10: Should be installed manually since it includes the actual Shell Theme too.

AwOken 2.5: Used to be available through PPA but at the moment install manually:

– Download from alternate links:

– Extract the three folders in your .icons folder

– Open up a terminal and enable access to customization script (AwOkenWhite is awesome enough without any customization, so these steps are optional):

cd .icons
sudo cp -p AwOken/awoken-icon-theme-customization /usr/bin
sudo cp -p AwOken/awoken-icon-theme-customization-clear /usr/bin
sudo cp -p AwOkenDark/awoken-icon-theme-customization-dark /usr/bin
sudo cp -p AwOkenWhite/awoken-icon-theme-customization-white /usr/bin
awoken-icon-theme-customization

2. Set the themes in the Gnome Tweak Tool like this:

Gnome Tweak Tool

An alternate, equally sexy setup involves setting the GTK+ to Minimal-3.10 as well – it’s a little darker and completely gray-scale.

3. Install and configure zpydr’s Taskbar extension:

sudo add-apt-repository ppa:zpydr/gnome-shell-extension-taskbar
sudo apt-get update
sudo apt-get install gnome-shell-extension-taskbar

Don’t forget to restart Gnome Shell by doing an Alt + F2 : r

In the Overview panel disable the Desktop and Workspace buttons and activate the Bottom Panel, then under Panels, change icon size to 36.

That was it… by now your desktop should look something like this:

Ubuntu Gnome Screenshot

This would be the decent minimum of sexiness I would go for – from this point I would probably add a few more useful extensions (with moderation) i.e. Alternatetab, Gmail, OpenWeather but kind of just that. Any more of these and minimalism turns into clutter-ism and really unnecessary eye-candy.

How to fix internet connection after moving HDD to a different machine

How to fix internet connection after moving HDD to a different machine

Where I live, it’s not uncommon that during an unexpected mighty thunderstorm, the current induced into the power grid fries most of the electronics along the way (some people might consider investing into some protection).

Long story short, recently one of the servers at work got struck (again) but the HDD seemed to have survived (this time) – luckily I found another machine with a similar build just laying around so I rushed to install the HDD on that one.

Linux is particularly good at handling hardware changes elegantly so I figured there wouldn’t be much that could go wrong, and I was right – the system booted nicely, all the data was intact but there was no internet connection. At that point I already knew I was supposed to look for a file, just couldn’t remember which one it was and where exactly it would be. I’ll just write the magic line that takes care of these sort of grotesque networking problems:

sudo rm /etc/udev/rules.d/70-persistent-net.rules

Yes, it is as easy as deleting a file – that one file that persistently stores networking configuration stuff like the MAC address for instance. Get rid of that and a brand new one will be created on reboot (this might not be true at all times – but since at the moment I don’t care, I will selfishly only elaborate once I do).

How to remove old Linux kernel headers

As time goes by and you keep installing more and more updates on a Linux machine, it will eventually get cluttered with all the kernels it has ever left behind. Probably the only time these can come in handy is when you can’t boot into a new kernel right after an upgrade.

The following command, which really is better than it looks, will remove all the previous kernel images, headers and modules that can and will take up precious disk space, leaving only the current one intact:

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

This can be useful on a server that performs automatic system-side incremental backups to an external storage device. Running this command will help delay that “dafuq” moment when the backup sizes exceed the storage capacity of the external drive.

Now, for the sake of any impending F*CKs, imagine how dumb it would be to run this command on a system that just had an update with a new kernel and hasn’t been rebooted yet…

Running dangerous commands in Linux

Fine-tune mouse acceleration / velocity in Ubuntu

Fine-tune mouse acceleration / velocity in Ubuntu

I’ve had different unpleasant experiences with different mice on different machines running various Linux distros, always longing for the magic behind Windows’ pointer precision enhancement. I’m an Ubuntu user and the only solution I found to fit my needs involves creating a custom script and running it automatically on boot.

First, we need to get the device ID of our beloved companion (in my case it was 10):

xinput --list --short

Then, experiment with different values on the Device Accel Constant Deceleration and Device Accel Velocity Scaling properties until you get the most comfortable feel.

xinput --set-prop 10 "Device Accel Constant Deceleration" 2
xinput --set-prop 10 "Device Accel Velocity Scaling" 5

Wrap those two lines in a setmouse.sh script and put it under /usr/bin, then just run the following line to add the script to startup

sudo ln -s /usr/bin/setmouse.sh ~/.config/autostart

In case the startup thing fails, you’ll have to try a different method of running that script automatically on startup. I will elaborate all that in a different post, explaining the differences and pros and cons of each method at a later time…