sailfish os – the true linux experience on your smartphone

From wiki:

Sailfish OS (also styled as SailfishOS[4] or abbreviated to SFOS) is a mobile operating system combining the Linux kernelfor a particular hardware platform use, the open-source Mer core middleware, a proprietary UI contributed by Jolla, and other third-party components.[1][2]

well, i would simply put it as:


if you are a linux user you will be at ease with this phone…

if you turn on developer settings then you have a fully fledged terminal (through terminal app) to do anything like your linux box…. (the lines “with more power comes greater responsibilites” resonates all over)

package manager: RPM

in other words, a rooted phone out of the box, set the root password and you are good to go……so, like all rooted phones, power in your hands….

One huge surprise (to me its the best thing about the phone):

NO back, home & recent keys

  • it’s only gestures you need and that’s how it should have been from the very beginning in a smartphone (touch device)…why do you need the keys?
  • a truly multi-tasking OS in the true sense which you will fall in love straight away….

to me google is no lesser evil than the coporates out there and a phone away from the clutches of google is like a true freedom at last…..

Can android apps (whatsapp, fb and the likes) still run on it?
YES they do but sailifish from its “jolla store” has alternatives for the major android apps.
not to disappoint the “play store” fans they run android apps on a special vm known as “android dalvik cache” in sailfish world which helps you download apps form google play store and run them as normal android apps….

stable but for rare instances when apps just doesnt open for sometime (in the starting stages but the latest update looks good)

it’s a refreshing OS, and if you havent checked it out, I suggest you get your hands on one right away!!!

final verdict – 4 out of 5 stars


ndoe js primer

What is node.js?

Direct from Source:

it is a headless javascript engine.

it is literally the same JavaScript engine (named V8) that runs inside of Google Chrome, except that with Node.js, you can run JavaScript from the command line instead of in your browser.

what i have understood from reading is that its like the lego toy you give to kid…

you have the blocks and now you got to make building, vehicles etc…the choice is what you want to build….

why is it popular?

node.js uses only one language (JavaScript) left, right and centre….

isnt’t it cool to make great apps just knowing javascript alone….well thats the power of node.js

so lets cut the talk and walk the talk….

a basic hello node in nodejs

var http = require('http'); //import the http module

http.createServer(function(req, res) { //create an http server instance equivalent to triggering an httpd start on linux for LAMP
res.writeHead(200); //write header for OK status
res.end('hello node..let us start');
//res.end('Blank lines');

save the file as http_test.js (name it what you want..doesnt matter)

open up a terminal and run the node instance

~[3]$>node /path/to/http_test.js

Fire up a browser and run


now you should see the lines on the page:

hello node..let us start

Well thats the node.js up and running

a very important thing not documented everywhere (it must be dont know why it isnt):

try changing the lines to something else

var http = require('http'); //import the http module

http.createServer(function(req, res) { //create an http server instance equivalent to triggering an httpd start on linux for LAMP
res.writeHead(200); //write header for OK status
//res.end('hello node..let us start');
res.end('hello node i cant run as you expect you wont see me');

try refreshing the browser page and you wont see your changes…instead you get a cached version of the file (older code ie. the older instance of node)

the reason is you need to restart the node instance with file name to re-parse the whole file…

you need to stop and re run the server to see your latest update.

ofcourse this is a pain in the ass to restart node instance everytime we make changes…but not to worry node.js has a great community and has already provided lots of solutions…

i prefer nodemon to automate the task of restarting node instance when you update your file or make changes to it

npm is node package manager your modules manager in node.js environment

1) Install nodemon. To install, from your terminal run:

npm install -g nodemon

2) Now, go to terminal, where you have the program. And, run

nodemon http_test.js

Now, everytime when you make changes to your app, just save your changes and it will get reflected.

Details :-

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server



Anonymous functions

what are anonymous functions?

Anonymous functions(aka. lambda) originating from the Lambda calculus are similar to our regular functions, in that they contain a block of code that is run when they are called (well, pretty similar and now you all know that before). They can also accept arguments, and return values.

The key difference — as their name implies — is that anonymous functions have no name.
Another difference is that they end in semicolons i.e. function definitions are expressions, whereas regular function definitions are code constructs.

so why do we need functions with no name?

the best solution or answer that can come to my mind is when you think of callbacks.

well, you can refer here and i have pasted the same below for continued reading

since an anonymous function is an expression — much like a number or a string — you can do various handy things with it. For example, you can:

1. Assign it to a variable, then call it later using the variable’s name. You can even store a bunch of different anonymous functions in a single array. – variable functions

2. Pass it to another function that can then call it later. This is known as a callback.

3. Return it from within an outer function so that it can access the outer function’s variables. This is known as a closure.


So, to code straight away and here is the example for the first set i.e. variable functions.

<pre>#use type one for anonymous function
#i.e. variable functions
class VarFuncs{
 public $my_var;
 public function __construct(){
 $this->my_var=function( $name, $timeOfDay ) {
 return ( "Welcome to another glorious $timeOfDay, $name!" );
 #workaround for PHP ver < PHPv7
 function __call($method, $args)
 if (isset($this->$method) && $this->$method instanceof \Closure) {
 return call_user_func_array($this->$method, $args);

 trigger_error("Call to undefined method " . get_called_class() . '::' . $method, E_USER_ERROR);

$object=new VarFuncs();
echo $check_output."\n";

As of PHPv7 we can replace the line 19 with

<pre>$check_output=($object->my_var)("nightslacker","night");//note the brackets around the object</pre>


Now, we can go on and implement the second point i.e. callbacks.

<pre>#use type two for anonymous function
#i.e. callbacks</pre>
class MainFunc{
private function toUpperCase($receiveArr) {
return strtoupper($receiveArr);
public function changeCase(array $arr){
return array_map(array($this,'toUpperCase'),$arr);
$objMainFun=new MainFunc();

$resultArr=$objMainFun->changeCase(array('nightslacker','changed','to','uppercased nightslacker'));

you get the result of the array with all caps for the array that’s passed using the callback toUpperCase


how to connect an android phone with linux to transfer files

the post i am going to present is for connecting your android phone with slackware or any linux distribution and secondly, transfer files to it….

here is the link that send me in the correct path!!! cheers to him!!!

first of all make sure you have the mtpfs library in your system…(slackers can fetch it from

we need to make a mount point for our phone….

i made it in /mnt as in /mnt/phone

once we got mtpfs installed run the below commands as i have typed them…

mtpfs /mnt/phone

mtpfs -o allow_other /mnt/phone

now the final step is to transfer files to phone…but wait….a normal mtpfs-sendfile wont work here…weird…..whats weirder is that android phone has all its folders mapped to a number….you need to use this number to transfer files to it…..

not to worry….mtpfs has the solution for it….

so to get the list of numbers for our folders in the android phone just type


now you get a mapping of key value pairs where each file in your android is mapped to which number…..i wanted to copy an mp3 file and it was 172

so am all set to transfer and i enter the below command:

mtp-connect –sendfile /path/to/file/nightcrawler.mp3 172

voila! and guess what the file was successfully transferred…..


Well that’s one way of doing it without a network around to help you.

Note: am editing this post and updating the content

If you got a wifi network where you use your laptop or desktop you do not have to go through all these hassles like above.

Just download any of the following apps from google play store:




I prefer Xender to Airdroid. its a much better interface.

So now once you got your phone and laptop/desktop connected to the same wifi network all you got to do is open any of the app in your phone.

It gives you an IP as well as a url.

Type it in your favourite browser on your laptop/desktop.

It will ask you “whether you want to accept or reject the connection in your phone”

Click on accept and you are good to go….


NOTE: Its a direct connection and hence it would not consume your ISP(Internet Service Provider) bandwidth or ISP data which is in layman terms as unlimited download and uploads from phone to laptop and vice-versa…

so as always happy slacking folks….

how to mount usb devices in slackware

a small primer or quick steps to mount usb devices on your slackware machine or for any linux distro…

as my personal motto goes: if it works in slackware, you can bet 99.99% its good to go in any other linux or unix flavors too….

before we begin lets switch user (su) to the root user

basically 4 steps to go through:

STEP 1:first, we attach the usb device to our laptop or desktop and check dmesg status to check if the usb is detected. dmesg requires privilege user rights hence we su before we go ahead…..

# dmesg | tail //here, dmesg piped to tail so as to read the last last few lines

usb-storage 2-1.1:1.0: USB Mass Storage device detected
scsi host9: usb-storage 2-1.1:1.0
scsi 9:0:0:0: Direct-Access hp v100w 1100 PQ: 0 ANSI: 4
sd 9:0:0:0: [sdd] 31285248 512-byte logical blocks: (16.0 GB/14.9 GiB)
sd 9:0:0:0: [sdd] Write Protect is off
sd 9:0:0:0: [sdd] Mode Sense: 43 00 00 00
sd 9:0:0:0: [sdd] No Caching mode page found
sd 9:0:0:0: [sdd] Assuming drive cache: write through
sdd: sdd1
sd 9:0:0:0: [sdd] Attached SCSI removable disk

STEP 2: we create a directory in our slackware machine, usually in the /mnt path but yes again you are free to place it anywhere you like..

# mkdir /mnt/usb_device

STEP 3: mount our usb device found from step 1, to this location.
we have seen from the output of step 1 that the usb is attached at sdd
again step 2 is for time use only as when we make this directory it will be available on our machine till we decide to do away with it…you can delete mount point after usage if you want just like how you delete a file….remember everything is treated as a file in *nix (linux or unix)…or keep it for all future usb devices being mounted….if you plan to mount multiple usb’s simultaneously make different mount points for each device….

mount /dev/sdd1 /mnt/ub_device //mounting our usb device to our path created on our machine

STEP 4: now you are good to go…cd to the directory where you mounted your device and browse the contents….

STEP 5: unmount the usb devices from the location using the umount command

umount /mnt/usb_device

happy slacking folks….

execute shell command from python script using subprocess module to search for a string in the directory of your choice

elementary script to execute shell commands using your very own python language…
i post this snippet here to demonstrate the power of python and yes an intro into the beautiful language called python and why i recommend learning it….

subprocess module in python helps to execute your favorite shell commands through python scripts…
for more references do look into python docs ->

diving straight into the code…..
equivalent linux command for the below script is: ls -ltrh some_directory | grep search_term

#Script to search for a term in unix shell
#equivalent linux command: ls -ltrh some_directory | grep search_term

#import sys module for taking system arguments from command line
import sys
#import subprocess module to execute unix shell commands from python script
import subprocess
#pass first argument as your directory
directory = sys.argv[1]
#pass second argument as the search string you want
search_term = sys.argv[2]
cmnd1 = subprocess.Popen(["ls", "-ltrh", directory], stdout=subprocess.PIPE)
cmnd2 = subprocess.Popen(["grep", search_term], stdin=cmnd1.stdout, stdout=subpr
output = cmnd2.communicate()[0]//cmnd2.communicate() returns a tuple containing (data of stdout,data of stderr)

print "*** Running ls -ltrh command on directory", directory, " and search term
:",search_term, "***\n", output

how to execute the above script from command line interface or CLI mode?
python /home/nightslacker/Documents pythondocs

on executing the above line, the script checks in the Documents folder for any file with pythondocs in their filename and returns the output on your shell

keep slacking folks!!! cheers!!!

how to chroot from installation media( or my installation disk) when my slackware doesnt boot

so, you get situations where you edit your /etc/lilo.conf file and fail to run /sbin/lilo…an example is upgrading the kernel or changing to a generic kernel etc….in such a case your slackware system fails to reboot correctly….and it prompts because of a failed lilo configuration….

selfless and selfish too because i need it posted to come back again cause it recurs way too often:

upgrading kernel without running lilo for me….

Relax, you are in safe quarters if you reached here…

follow the steps here to get back up and running….

quoting from

In order to gain access to your system without booting directly to it, it is possible to use an installation media such as Slackware CD1 or the DVD. Once the installation media loads and starts, you can change the media’s root directory into a mounted hard-disk partition and use it as the root directory, thus running commands directly from it and affecting it.

1. so the first step is to mount your root partition….if you dont know your root partition just enter fdisk -l and check for the linux partition in it….

(let me explain for a single partition….If this is not the case, and you are using LVM/EVMS or an encrypted volume you will need to prepare the volumes before you can mount and chroot into them)

2. if its /dev/sda1, type

mount /mount/sda1 /mnt

3.   next, we need to prepare three virtual directories to be used by the environment. Those are /dev, a directory with virtual files that represent hardware devices, /proc, a directory with virtual files that represent processes and /sys which contains the kernel and other system files:

mount -o bind /dev /mnt/dev

mount -o bind /proc /mnt/proc

mount -o bind /sys /mnt/sys

4. now, since the partitions are mounted now we can chroot to it

chroot /mnt /bin/bash

quoting slackdocs again…..making my life easier…..

“The bash prompt that you see here is a bash prompt started on your system. You can now work on this environment naturally. For example editing /etc/lilo.conf and executing /sbin/lilo will happen on your system, not from the installation media.”

thats all there to it….now with the help of your installation disc you can use your underlying system when it doesnt boot up…

5. when you are done using, dont forget to run lilo again….and then there is the reboot or poweroff command which you can execute as per your needs….

*i was a bit panicky when my slackware failed to start…..but slackware it always surprises you with its tools…..and the folks at LQ…they keep your worries out….

keep slacking!!!