Monday, August 7, 2017

ssh timeout with ec2 aws instance

While reading some posts such as this I realized that aws cuts your connection after only 60 seconds of inactivity. This became annoying, so I decided to follow some of the recommendations in the posts I came across and this worked for me. There are two ways to do this: one is by changing the ssh configuration in the  server by keeping all client connections alive as follows:

open the file /etc/ssh/sshd_config on the virtual machine

add the lines at the end of the file

ClientAliveInterval 50
ClientAliveCountMax 10


restart the service or reboot the system

sudo service ssh restart



The other way is to keep any server alive by changing the ssh configuration on the client machine or local machine. To do it for all users in the local machine open the file


sudo vi /etc/ssh/ssh_config
add the following line under the host * section:

ServerAliveInterval 50

Thursday, November 10, 2016

Monday, August 15, 2016

Sum of Consecutive, Even, Odd and other numbers

Consecutive numbers:
S=N(N+1)/2

*N includes the first element that is why we add 1 at the end

Even numbers:
N= ((Last - First)/2) +1
S= N(N+1)

Odd numbers:
N=((Last-First)/2)+1
S= N^2

Other numbers:
S=Avg * N
N=((Last-First)/Spacing)+1

Friday, June 17, 2016

Torch GenerateFingerprintTables.cpp:122: undefined reference to `gflags::

I had to reinstall this library since the version I had was an old one, even though linux said it had the latest version.

I cloned the repository and followed the instructions

https://github.com/gflags/gflags/blob/master/INSTALL.md


On thing that I needed as an option was to add the

CMAKE_CXX_FLAGS=-fPIC

Because I needed the library to work with torch, so I just went to the advance options of ccmake and looked for that variable and changed it. 
gflags didn't give me a problem after that. I am still trying to install the other dependencies for fblualib but we will see how that goes. 

Good luck


Tuesday, May 10, 2016

(ERROR)icvOpenAVI_XINE(): Unable to initialize video driver on OpenCV 2.4 and Linux 14.04

I was getting this annoying error so I looked up some solutions and found this installation helped. Good luck

 sudo apt-get install libxine1



Tuesday, May 3, 2016

Brother HL-L2380DW refurbished not working on windows 7

I installed the driver as indicated by downloading it from the website and used it from the cd that came with it but none of it worked. I tried to get the wireless connection working and followed all the steps. I even troubled shooted the printed but that didn't help. One reason why it didn't work for me is because there was a port issue, the default setting under Properties->Ports was selected as LPR, once I switched to Raw the connection happened and it worked!

I hope this helps someone out there.

Wednesday, April 6, 2016

Getting eclilpse debugger working on torch

I have learned today that installing torch on eclilpse could be a little daunting, however, could also be very powerful.

I wanted to install this library
https://github.com/karpathy/neuraltalk2

with a debugger on eclipse since I have heard it has the best debugger.

I followed this instructions to do that:

http://www.lighting-torch.com/2015/07/27/configuring-eclipse-with-torch/

This are very detailed instructions and if you are lucky it should just work right off the butt.
However, I wasn't that lucky and I did end up doing some trial and error things.

I had an issue with getting qlua running on eclipse as an interpreter. I had some weird errors such as
qlua: ./misc/DataLoaderRaw.lua:45: attempt to index global 'path' (a nil value)
Which I wasn't sure what they were.

I googled around and first I made sure the environement was installed

sudo luarocks install env

to call it with qlua -lenv as I was doing previously.
what it really helped is to install
sudo luarocks install penlight

and add

local path = require 'pl.path'

to all the scripts that needed it. For some reason that was the main cause of my problems. I am a newbie at torch but for now I am happy with torch and my debugger.

Also for this particular library, it uses cunn and gpu which requires having cudnn installed and on the ld library path.
Hence in order to have this working I needed to go to Run->Run Configureations->Environement
I create a new variable called LD_LIBRARY_PATH
and give it a path something like this:
 /usr/include/python2.7/:/usr/local/cuda-7.5/lib64:/lib:/usr/local/lib/:/home/onina/cuda/cudann/lib64: