Installing chrome as non root user

If you want to install google chrome as a non root user in debian (e.g. jessie) you have to simply:

1. Unpack the .deb manually

dpkg -x google-chrome-stable_current_amd64.deb /local/mysoft/chrome

2. Start chrome with –no-sandbox option

/local/mysoft/chrome/opt/google/chrome/chrome --no-sandbox
Posted in Uncategorized | Leave a comment

Redirecting the output of scp to a log file

Logging the output of scp (and similar commands) doesn’t work the straightforward way of a simple redirection because scp uses direct terminal codes and if it detects a redirection, it doesn’t output anything.

Fortunately there is a command called script which is able to simulate a terminal so the output could be recorded.

To trace the output of

scp $REMOTE_SERVER:~/test/test.file /dev/null

Wrap a script command around

# fetch the file, but don't store it locally
script -q -c "scp $REMOTE_SERVER:~/test/test.file /dev/null" 2>&1 | tee scpLog
# replace carriage return with newline
sed -i -e 's/\r/\n/g' scpLog

And your’e done

Posted in Uncategorized | Leave a comment

Find out which bad guy has fiddled on your workstation

Lastly i sat in a meeting and suddenly my vnc session to my workstation was killed. First, i thought we had some network problems, but i encountered my workstation was rebooted!

But how to figure out, who this was?

Luckily there’s a nice command called: last.

# Show last logged in users
last

This command basically uses the file /var/log/wtmp as it’s source. After a reboot this file seems to be rewritten, unfortunately.

# This file only goes back to the last reboot, so we need 
# to look around to find pevious version
ls /var/log/wtmp*

# => Output (filenames depend on your machine configuration, 
# i have a RHEL 7 box)
wtmp-20160114

# the file itself is not human readable but could be used 
# as input for last
last -f /var/log/wtmp-20160114

Now could clearly see, who was the bad guy …

Posted in Uncategorized | Leave a comment

MenuMeters for OS X El Capitan 10.11

A very nice guy has made some modifications, so MenuMeters could be run on OS X El Capitan:

Source: MenuMeters for OS X El Capitan 10.11

Posted in Uncategorized | Leave a comment

Using own search predicate in C++ find_if() for finding attributes in collections of data structures

If you want to find a complex data structure in a collection but looking only for a single attribute, e.g. the ID of a monster in a collection of monsters.

You need to write your own search predicate:

struct find_monster
{
    DWORD id;
    find_monster(DWORD id) : id(id) {}
    bool operator () ( const monster& m ) const
    {
        return m.id == id;
    }
};

it = std::find_if( monsters.begin(), monsters.end(), find_monster(monsterID));

Thanks to: http://stackoverflow.com/a/590005

Posted in Uncategorized | Leave a comment

Using Open Office date/time values for calculations with regular numbers

I had a a date/time field in a time sheet which contained the sum of other date/time fields in the form hh:mm. I want to use it as a regular number to convert them in a very client specific format. The solution is very simple:

24:00 will be converted to 1.0

I hope that’s a general rule, not specific to my current Open Office version.

Posted in Uncategorized | Leave a comment

Add a NIS user to be a member of a local group

sudo groupadd local_group
sudo gpasswd -a nis_user local_group

linux – Can an NIS user be a member of a local group? – Super User.

Posted in Uncategorized | Leave a comment