Sonntag, 21. Februar 2016

configuring raspbian jessy for easy ssh access


Configure your pi with
sudo raspi-config
Within the menu, do the following
- change the name of your pi, for example 'pi1'
- allow ssh access
- change the password (and remember it)

restart the pi

Now, from some other unix computer, you want to scan the local network for connected devices. This can be done with nmap. You also need to know the IP address of your local network, which is normally 192.168.0 or 192.168.1, but better find it out with either ifconfig or ip addr.
Step by step:
- Install nmap
sudo apt-get install nmap
- find your local networks IP address with either
ip addr
or
ifconfig

joker@joker-Ultrabook:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr e8:03:9a:ee:f4:2b 
          inet addr:192.168.0.131  Bcast:192.168.0.255  Mask:255.255.255.0
 
In this example, my devices IP is 192.168.0.131, so my local networks address is 192.168.0, 131 being my laptops number.

- search the network with nmap:
nmap 192.168.0.0/24

24 is shorthand for subnet mask 255.255.255.0

 As a result, nmap shows you all devices in the network, including your pi. Of course the pi has to be connect to the network via cable or wifi:
Nmap scan report for pi1 (192.168.0.119)
Host is up (0.011s latency).
Not shown: 999 closed ports
PORT   STATE SERVICE
22/tcp open  ssh

Nice, the pi is there, ssh is open, and its correctly named 'pi1'.
You could use its IP address 192.168.0.119 to ssh into it, but using the name is much easier.
ssh pi@pi1




 



Freitag, 19. Februar 2016

I checkout back into my master, but it still looks like the branch I was working on?

Short story:

You have to commit your changes in the branch before checking out to the master. So the solution is to checkout back to the branch, commit the changes, and checkout to master afterwards.


Long story:

I started implementing multiprocessing. Naturally, I didn't want to mess up my code, so I created a new branch 'multiprocessing':
git checkout -b multiprocessing
Some hours of biting my nails later, I had it running, and even saw some improvement in speed. I also learned, that implementing multiprocessing in python is easy, but finding the right tasks that can be processed in parallel with speed improvement is hard.
Anyway, the code I wrote was far from clean, but my curiosity was satisfied for now. I  decided to put that project aside and get back to it later.
So I checked out to my master:
git checkout master
When I ran the tool later, I realized that it started working on multiple cores. Had I forgotten to checkout? So I had a look:
git branch
and it confirmed that I had correctly checked out:
joker@joker-Ultrabook:~/VCF2AFAnalysis$ git branch
* master
  multiprocessing
  plot_labels

Still, the code was the one I wrote while checked out to multiprocessing.
So I checked out back to multiprocessing:
git checkout multiprocessing
and commited the changes
git commit -am 'started implementing mp'
After checking out to master everything was alright.


I don't know why git doesn't tell you that you always have to commit your changes before checkout, but well, that's just how he wants it.