Conky

One of my first ever posts was about conky and wbar on crunchbang linux.

Crunchbang has since been replaced with a community led fork, Bunsenlabs, and it’s well worth checking out.  I’m so impressed with it that it’s my laptop OS of choice, giving me very little grief installing onto my disappointingly-not-particularly-linux-friendly Dell XPS 15, unlike other popular distros.  Suffice to say, Bunsenlabs has saved my XPS15 from the financial damage limitation exercise known as ebay.

In any case, I thought I’d include a link to my own .conkyrc file.  It’s simple and neat, nothing too fancy.

The download file is called conkyrc.  Once downloaded, just rename it to .conkyrc i.e. put the dot in front (hidden file and the conky default), and copy it to your home directory, remembering to back up any existing .conkyrc file already in your home directory first.

If you want to edit yours to make it your own, the man page for conky is very good, but I find this better.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Retro Terminal

This is just too good.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Fun with Cowsay

The terminal can get a little tiresome by the end of a full working week, so why not use cowsay to add a little fun to your stdout?

Just be sure to check its actually installed before you start calling it from your shell scripts.  I found it was installed by default on Debian based distros but not on a Centos7 VM i spun up using vagrant, so you’re mileage may vary as they say.

Installation

sudo apt-get install cowsay

Basic usage

cowsay “hello”

View all the possible “cows”

ls -1 /usr/share/cowsay/cows | cut -d . -f1 | while read eachline; do cowsay -f $eachline “$eachline”; done

There’s loads of them and more to choose from online too.  In the meantime, here’s a couple dragons to whet your appetite…

Facebooktwittergoogle_plusredditpinterestlinkedinmail

PS4 Won’t log in to PSN

A major annoyance with the Sony Playstation 4 is that intermittently the PS4 won’t log in to PSN.  And unless it successfully logs into the PlayStation Network, pretty much all your apps are useless.    It’s really annoying that the PSN needlessly gets in the way of my ability to watch a programme on All4 or BBC iPlayer etc that have no dependency on the PSN whatsoever.

This is extremely frustrating when you know its connected to the internet and iPlayer or All4 service is operating normally, but you can’t do what you want to do, because you have a stupid (No)Play Station.  GRRRR!!!  It’s so Sony to do this too.  Not a fan.

If it wasn’t for my Gran Turismo addiction, I’d bin it.

So.  To improve matters, you need to set up your network connection again, only this time do it a little differently, specifying the DNS and MTU settings manually.

Primary DNS: 8.8.8.8

Secondary DNS: 8.8.4.4

MTU: 1473

Settings, Network, Set Up Internet Connection

Choose Wi-Fi or Cabled connection

Choose Custom

Automatic should be fine but I find it connects to the internet faster using a static IP Address.   If you do specify an address make sure it an address outside the scope on the DHCP server to prevent a potential IP address conflict on the network.  You may need to log onto the router and reduce the default DHCP scope accordingly, or set a reservation for the PS4.  Make sure your subnet mask is 255.255.255.0 unless you know better and your gateway likely looks like 192.168.x.1 where x is either 0 or 1.

Manually set the DNS addresses to those of the Google DNS Servers

Leave DHCP settings alone unless you want to receive an IP address from a DHCP server on your LAN other than the one on your wifi & router supplied by your ISP.

Set the MTU manually.  This pertains to the message transfer unit size on the network.  The default is 1500, but 1473 works better.

That’s it for the networking config.

Make sure it’s set to connect to the Internet

Something else you can check is in Settings, Users, Login Settings for your User, make sure the check box “Automatically log in to PS4 automatically” is checked.

Reset PSN Account Password

The thing that ultimately made the difference for me, was in Settings, Account Settings, Re-enter your PSN Password.  I don’t know what happens “behind the scenes” when you do this, but boom!  it logged straight into the PlayStation Network no problem and my apps all work perfectly.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Mount USB HDD by UUID in Linux

The danger with USB hard disk drives is that when you have more than one plugged into your workstation, the device name assigned to it by the operating system might not be consistent between reboots.  i.e. /dev/sdb1 and /dev/sdb2 might swap places.  Potential disaster if you rsync data from one to the other on a periodic basis.

If permanently mounting usb hard disks, it’s much safer to mount according to the UUID of the disk instead of the device name assigned by the OS.

If you change to root using sudo su – and cd into /dev/disk you’ll see that there are multiple links in there, organised into different folders.  The unique unit id is written in /dev/disk/by-uuid and links the device name to the unique id.

You can see what device name is mounted where using df -h.  Then use the output of ls -al of /dev/dsk/by-uuid to correlate uuid to filesystem mount.  There’s probably other ways to match filesystem to uuid but this is quick and easy enough to do.

Note that I’ve also taken the liberty of piping the commands through grep to reduce output, just showing me what I want to know,  i.e. the uuid’s mounted to devices named /sda1, /sda2, /sdb1 etc.

Once you’re confident you know what UUID is what disk, then you can permanently mount the disk or disks that are permanent fixtures by creating a mount point in the filesystem and adding a line to /etc/fstab

finally, mount -a will pick up the UUID and mount it into the mount point.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Install hevc codec for .mkv video on Linux Mint

Given how complete Linux Mint is out of the box, I’m surprised to have experienced this problem even after installing all extra codecs from the repositories after initial installation.


Upon attempting to play the latest .mkv episode of Silicon Valley, I received the following error in VLC Media Player.

“unable to decode hevc, there’s nothing you can do about this error”

Or words to that effect.  I’d include a screen-shot of the error but I’ve fixed it now, so am sharing the fix with you instead.  I’ll keep it succinct.

sudo apt-add-repository ppa:strukturag/libde265

sudo apt-get update

sudo apt-get install gstreamer0.10-libde265

sudo apt-get install gstreamer1.0-libde265

sudo apt-get install vlc-plugin-libde265

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Installing Dropbox on ElementaryOS (Freya)

ElementaryOS is the closest thing to Mac OS-X in terms of consistency and minimalism of it’s desktop environment interface.  Unlike other Linux distro’s it’s released when the developers think it’s ready, rather than a 6 month rolling cycle.  It’ll take a lot to turn my head away from Linux Mint but Elementary has got a lot of things going for it to be quite honest and I’ll leave you to discover them yourself.  I’m only interested in problems, and the first one I ran into was installing Dropbox.  Installing it from the Software Centre doesn’t work.


They way to sort it, is to install git using sudo apt-get install git

Once git is installed, then run the following commands

git clone https://github.com/zant95/elementary-dropbox /tmp/elementary-dropbox
bash /tmp/elementary-dropbox/install.sh

dropbox-inst-elementary

Dropbox will then open, asking for your account username and password, and the Dropbox sync icon will appear in WingPanel.

References:

https://github.com/zant95/elementary-dropbox

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Quick surface plots using GNUPlot

GNUPlot is a free and very neat little graphing tool.  Upon installing it and running gnuplot you’ll be presented with a flashing command line prompt gnuplot>_ at which point you’ll be asking yourself “now what?”

gnuplot either plots data using plot or plots 3D surfaces using splot.

In this example, I’ll plot a surface plot (3D splot) of weekday (x), hour (y), number of jobs running (z).

gnuplot likes to be fed its data in text column format, separated with spaces or tabs but not commas e.g.

#day #hour #jobs
1 1 5
1 2 5
1 3 5
1 4 5
1 5 5
1 6 5
1 7 5
1 8 5
1 9 5
1 10 5

To create a surface plot of this data (my sample data used has values for all 24 hours in all 7 days), simply type

splot ‘path_to_data.dat’ to point to your text file containing your columns of numbers.

The results will be something like this.  Good, but not quite there yet.

gnuplot1

 

 

 

 

 

 

 

 

 

 

Some extra commands in the gnuplot command line window will improve the visual representation of the data, giving us the surface plot we’re ultimately after.

set dgrid3d

set grid

set view 50

set style data lines

set contour base

set hidden3d trianglepattern 7

set autoscale

Finally, use the command replot to update the graph.  The results are now much more usable, with contour lines on the base of the 3D graph to further highlight the “hot spots”, i.e. the hours of what day the most jobs are running (in my example).

gnuplot3

 

 

 

 

 

 

 

 

 

 

 

There’s much more fun to be had tweaking GNUPlot but I’ll leave that up to you and your imagination.  It’s worth finally mentioning  that the commands entered into gnuplot can be scripted and saved as a .plt file to compliment your .dat data file.  Then, to plot the surface maps again, you just need to load the script using…

load ‘path_to_script.plt’

Remember, the final line in your script should be

splot ‘path_to_data.dat’

so that the graph is actually generated, with all the options preceeding it.  e.g.

#My GNUPlot surface map script surf-map.plt

set dgrid3d

set grid

set view 50

set style data lines

set contour base

set hidden3d trianglepattern 7

set autoscale

splot ‘data.dat’

How you generate your actual data to be plotted is up to you.  A scheduled task/cron job which collects the data and appends it to the data.dat file is generally run as a separate shell script, e.g.

#!/bin/sh

#Insert newline into data.dat
HOURVAL=`date | awk {‘print $4’} | cut -d: -f1`
DAYVAL=`date | awk {‘print $1’}
RUNNINGGROUPSVAL=`ps -ef | grep savegrp | wc -1`

echo “${HOURVAL} ${DAYVAL} ${RUNNINGGROUPSVAL}” >> ~/data.dat

and the graphs generated at will using gnuplot.

Depending on the shapes generated by the surface map, it’s a nice touch that GNUPlot allows you to left-click on the graph and drag it around in 3 dimensions to achieve the best possible viewing angle, prior to saving the .png file, conveniently colouring the underside of the surface a different colour to the upper, visible side of the surface.

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Improve Laptop Battery Life

If you’re running ubuntu or xubuntu then you can improve battery life by running the following script.

Read the tweaks carefully as they prompt you for a y/n answer since answering yes to all will render your usb sockets useless when on battery.  You’ll get an icon in the tray that will allow setting of multiple performance modes, namely Conservative, On Demand, Powersave and Performance as well as a list of possible CPU frequencies.

To Install and Enable it…

cd && wget -O .laptop-mode.sh http://goo.gl/7SPJWP

chmod +x .laptop-mode.sh && ./.laptop-mode.sh

To Remove it..

cd && wget -O .laptop-mode-uninstall.sh http://goo.gl/IGVK8e

chmod +x .laptop-mode-uninstall.sh && ./.laptop-mode-uninstall.sh

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail