Tuesday, 12 April 2016

virtualbox internetworking




vboxmanage dhcpserver add --netname testlab --ip 10.10.10.1 --netmask 255.255.255.0 --lowerip 10.10.10.2 --upperip 10.10.10.12 --enable




If you see the vm image, in the network section: you will be having something like:

Intel PRO/1000 MT Desktop (Internal Network, ‘testlab’)

And in the host you will see ip as: 10.10.10.3 and something else like: 10.10.10.2 and you can ping to each other.


# What to do, to have internet even?

In the above setting, we are not able to connect to external network. But internal networking working fine. 

With NAT its working fine :) and in NAT, we can do port forwarding and to access the port what we want to access.




### And in NAT, we can do port forwarding and to access the port what we want to access.

Example:



Select Port Forwarding and can configure.





External link:

https://www.youtube.com/watch?v=lhOY-KilEeE



Monday, 14 March 2016

who need other app to copy files from pc to phone



Some time we need to copy few files from our computer to our smart phone and most of the time we use the data cable to copy data for that, and sometime, we need to install some other application again on our system [  example: Android File Transfer ] and who need keep taking there data cable!

Who wants to read long document to get things done. So lets do the work:

Requirement: 
1. You need to have python install
2. Your system and phone need to be in the same wifi network.
[I don't have wifi, No problem, make your phone as wifi spot and make your system to join that network. ]

Why to do this, we can do ever other way: 
We can use bluetooth, but this is faster.
We can configure web server, but why to do lots of that work too? Need to install webserver and configure too.

So... Here is the steps:

steps1:
cd to the directory where you have the file located.
start python SimpleHTTPServer on any port. [Make sure, you don't have firewall blocking this]

python -m SimpleHTTPServer 60000

Step2:
On your smart phone open web browser, and give the ip address of your system:<port>

example: my laptop ip 192.169.1.100 and I am running the  python http server on 60000, then on my smart phone web browser:

http://192.168.1.100:60000/

Here you go, you can see all your files, that you want to copy. Select the file and do "save as link" and the file is copied to your smartphone.

Tuesday, 9 February 2016

jenkins_with_api

How we can use jenkins with the api.

Lets say we have a job called "test_job" and your username is "amund" and your token is "my_long_token_string" and your "test_job" is parameter driven, then:

consider your patameter name is: "name".

command example:

curl -X POST http://amund:my_long_token_string@jenkins_server:8080/job/test_job/build --data-urlencode json='{"parameter":[{"name":"name","value":"your value"}]}'



NOTE:

http://username:token@IP:port/job/job_name/build --data-urlencode json='{"parameter":[{"name":"name","value":"your value"}]}'


You can also use your username and password, but its not recommended:


curl -X POST --user <username>:<password> http://jenkins_server/job/your_job/build --form json='{"parameter":[{"name":"given_name","value":"your_value"}]}'

OR

curl -X POST --user <username>:<password> http://jenkins_server/job//your_job/build --form json='{"parameter":[{"name":"given_name","value":"your_value"}]}'



If you want to create a script on the top of the curl call, you can do that, note that within the json if you are using a variable you need to use as example:

example:
IPADDRESS=$@

in general we can use as ${IPADDRESS} or $IPADDRESS

inside json data, we need to use as:

"'"$IPADDRESS"'"

which is: " then ' then " and close the same.

example:

curl -X POST http://${USER}:${TOKEN}@${JENKINS_SERVER}/${JOB} --data-urlencode json='{"parameter":[{"name":"IPs","value":"'"$IPADDRESS"'"}]}'