Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Friday, October 6, 2017

Profiling C++ applications on Ubuntu

Sometimes it is necessary to check the performance of applications at function level, in order to see what are the functions that consume the most time during program execution. I'm going to go through two methods of profiling and exploring the results in a graphical manner.



Tuesday, January 12, 2016

Configuring ssh keys for git access on Ubuntu

To be able to connect to a git repository with ssh access (ssh://) use the following steps:
  • copy your private key file to ~/.ssh
  • create (if it doesn't exist) the file ~/.ssh/config and add the following content:
Host my_githost.com
    HostName my_githost.com
    User my_username
    IdentityFile ~/.ssh/my_private_key_file
  • change the permissions to the private key file:
chmod 400 ~/.ssh/my_private_key_file
Now you can clone your repository.

Sunday, December 13, 2015

Running a stand alone child process from a parent process

Sometimes it is necessary to start a process from within another process, whether it is for executing a command line utility or to create a peer process with which the parent process will need to communicate.



Detaching a process from the terminal

Sometimes it is useful to detach your application from the console terminal. It may be because you're building a daemon or simply because you don't want the application closing when the user ends his terminal session.



Monday, April 13, 2015

How to drop root permissions in C

Sometimes it is necessary to run an application with root permissions in order to do some elevated work like binding to ports lower than 1024 or writing to files in /var/log, etc.  After the elevated work is finished, it is good practice to drop the root privileges and continue with the execution path as a non-privileged user. The motivation is based on security reasons: if ever an attacker takes control over your application, it should not give him control over the whole system.



Saturday, April 11, 2015

Getting the stack trace programmatically in C

In some situations where applications run for a long period of time on remote systems, if the application crashes, there is little information about the crash: no core dump or valuable log available. In such cases it is useful to get and log the stack trace at the moment of the crash, thus having some more information in order to solve the problem.
Getting some information about the stack trace is possible using C, as we will see below.



Sunday, January 25, 2015

Installing Android Studio on Ubuntu 14.04 LTS, Trusty Tahr 64 bit

Installing Android Studio on Ubuntu 14.04 64 bit can be quite tricky. Here's a list of issues I encountered while trying to get it up and running.

First get Android Studio from the official location here, and install it using the guidelines for your specific OS.