Archive

Archive for July, 2015

[manjaro] Steam crashes upon start

July 31, 2015 Leave a comment

Problem
Steam is about to start but it crashes after a few seconds.

Solution
Launch “steam” in command line, thus you can see its output. One line said “STEAM_RUNTIME is disabled by the user“. Here is the cure:

export STEAM_RUNTIME=1; steam

Here is a launcher script (steam.sh):

#!/usr/bin/env bash

export STEAM_RUNTIME=1
/usr/bin/steam &
Categories: Uncategorized Tags: , ,

mount an NTFS partition automatically upon boot

July 30, 2015 Leave a comment

Problem
You want to mount an NTFS partition automatically upon boot.

Solution
It is nicely explained here: https://wiki.archlinux.org/index.php/NTFS-3G#Configuring . To figure out the UUID of a partition, see my previous post.

Once you modified the /etc/fstab file, you can test your settings without restarting your machine. Make sure that the partition is unmounted and mount everything with the command “sudo mount -a“. Verify if it’s mounted correctly.

Categories: linux Tags: , ,

get the UUID of a partition

July 30, 2015 2 comments

Problem
You want to figure out the UUID of a partition. For instance, you want to mount a partition upon boot and thus you want to add it to your /etc/fstab.

Solution

$ sudo blkid

The blkid program … can determine the type of content (e.g. filesystem or swap) that a block device holds, and also the attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).” (source: man)

Update (20150803)
As msx pointed out in the comments, you can also write “lsblk -f“, which doesn’t require sudo rights at all.

U

Categories: bash Tags: , , ,

[manjaro] install the theme xfwm4-theme-w8-mono

July 30, 2015 Leave a comment

Problem
There is an awesome theme for XFCE called w8 that make your window borders look like Windows 8. However, with yaourt I cannot install it for a while. A long time ago it worked, but something happened to the package :( How to install it manually?

Solution
Visit https://aur.archlinux.org/packages/xfwm4-theme-w8-mono/ and download the source. Unpack it somewhere. Then switch to root mode and copy it to the /usr/share/themes folder (thus you will have a /usr/share/themes/w8/xfwm4 folder with some files in it). Open Xfce Theme Manager, click on the Advanced button, then click on Rebuild DB. Now under the “Window Borders” tab w8 should appear.

In this post I also write about this theme (and explain how to move window buttons to the left).

Categories: manjaro Tags: , , ,

taking a screenshot about a webpage

July 11, 2015 Leave a comment

Problem

You know the URL of a webpage and you want to take a screenshot of it. For instance you want a thumbnail about the webpage.

Solution

It can be done very nicely with PhantomJS.

What is PhantomJS?
PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.” (source)

How to install PhantomJS?
Follow the instructions here. Under Ubuntu I compiled it from source to get the latest version. Note that it takes a lot of time (about 30 minutes). Under Manjaro I could install it via yaourt and it took 1 minute (and got the newest version). The good news is that installation is not a problem.

How to take a screenshot?
If you download the source, you get a lot of example scripts. One of them is called rasterize.js, and this is exactly what we need.

$ phantomjs rasterize.js 
Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]
  paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"
  image (png/jpg output) examples: "1920px" entire page, window width 1920px
                                   "800px*600px" window, clipped to 800x600

Example #1:

phantomjs rasterize.js http://raphaeljs.com/polar-clock.html clock.png


Example #2:

phantomjs rasterize.js https://www.reddit.com/ red.png

It produced an image with dimension 600×3304. It’s too narrow, let’s fix that.

Example #3:

phantomjs rasterize.js https://www.reddit.com/ red.png 1024px

Its dimension is 1024×2432. Looks much better.

Example #4:
The previous image was too high. Let’s take a photo of that part that would be visible on our screen. For this we need to clip a window.

phantomjs rasterize.js https://www.reddit.com/ red.png "1024px*768px"

Great. Now scale it down to get a thumbnail.

Scaling down an image to thumbnail size

$ phantomjs rasterize.js https://www.reddit.com/ screenshot.png "1024px*768px"
$ convert -resize 250 screenshot.png thumb.jpg

The command convert comes from the ImageMagick package. Here we resize the image to width 250px. Convert will keep the image ratio, i.e. it figures out the height value.

Links