Friday, 26 August 2016

Tip - place for scripts

* A place for putting common scripts (with execution permission) that must be available for all the system is

/usr/local/bin
It can be called in any location.   



* Also,when trying to run commands or scripts on startup you can put the required command to run inside the file
~/.bashrc for a local command
or
/etc/bash.bashrc for a global command (for example a command that requires sudo). 

Both of the above commands will ask for the sudo passwork. If you do not put sudo, the script will not run if it requires administrative priviledges

You can also put a command that requires sudo inside your local .bashrc but you will be asked to put the sudo password everytime your start a command line or the .bashrc is processed (for example when running source ~/.bashrc)


* Also, to run an administrative command without having to put the admin password and that you want to be executed at the end of each multiuser runlevel, put your command in the file

/etc/rc.local
Also, take into account that you do not need to put sudo, the execution of this file has already administrative priviledges .
 
Do not forget to finish the command by providing an exit value. 0 means sucess and any other value means error.
Example:  
exit 0 
 
 
* For other related information, visit:
http://askubuntu.com/questions/228304/how-do-i-run-a-script-at-start-up

Friday, 19 August 2016


Setting static ip for your network card
 Edit the file /etc/network/interfaces and add this:

auto wlan0
iface wlan0 inet static
address 10.0.1.1
gateway 10.0.1.1
netmask 255.255.255.0
network 10.0.1.0
broadcast 10.0.1.255

wpa-ssid 'mynetwork'
wpa-psk '12345'


In order for this to take effect the networking service must be restarted
$ sudo /etc/init.d/networking restart


For more info, look here-> https://help.ubuntu.com/community/NetworkConfigurationCommandLine





Thursday, 18 August 2016

Computers in a network




Arp-scan can scan the computers in a network
* Using Wi-Fi:
sudo arp-scan -l --interface=wlan0
* Using ethernet:
sudo arp-scan -l --interface=eth0 
* Connection by usb 
sudo arp-scan -l --interface=usb0
 
Answer from system:
Interface: usb0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.2.15 02:00:86:9b:2a:ad (Unknown)

1 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 1.289 seconds (198.60 hosts/sec). 1 responded

Thursday, 5 May 2016


Python Function Arguments

In contrast to many languages, python has several types of parameters to be sent to a function:
  • Required arguments
  • Keyword arguments
  • Default arguments
  • Variable-length arguments
A tutorial about that is here: 
http://www.tutorialspoint.com/python/python_functions.htm


Tutorial to work with Python and Opencv

Complete tutorial.
http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/