Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

Wednesday, 29 June 2016

How to install android studio

Android studio is a development environment for creating android apps.

To install it you first will need to download it from here. After you have downloaded it you will have a file called something like "". You need to unzip this file to be able to use it.

To do this run:

You should now have a directory that looks something like this:
You now need to enter the "bin" folder and run the script  "". If you are unsure how to run the script:
Now complete the setup following the instructions it gives you, once you are done close the program down, we can now start installing the program.
Do this after you have completed all of the other steps as you will have to reconfigure it so it will waste your time otherwise.

Steps to install:
  1. Locate where your android studio bin folder is located.
  2. Add this to your PATH variable.
  3. Rename to studio.
Step 1:
First you need to cd to the unzipped android studio folder as shown in the picture earlier on. You then need to cd to the bin folder. You can now rename to studio.
mv studio

You can now run the pwd command to get the full location of your directory.

You can now see that the directory is located at "/home/matty/Downloads/android-studio/bin"

We now need to add this path to your PATH variable. We do this so that you can type studio and open up the android studio from the terminal.


Note: YOUR PATH TO THE DIRECTORY is what we have just got from the pwd command, this should be added without the quotes for the above command.

You should now be able to type "android" into your terminal and it will open the android studio.

Are you vulnerable to the bash bug?

The Bash bug or shell shock as it is also known, is a bug in the bash shell. It allows code to be remotely executed on your server. This could lead to malicious code being installed to your server and it no longer being your server.(CVE-2014-6271)

How to test if you are vulnerable:
First you will need to open a terminal on your server/PC.
You now need to enter this command:
env x='() { :;}; echo this text should not be seen' bash -c 'echo This text should be seen'
If you get the message "this text should not be seen" then you are vulnerable.

How to patch this vulnerability:
To patch this vulnerability we need to update bash.
This is a simple task that can be solved in a few commands.

Debian systems patch:
Run these commands.
sudo apt-get update
sudo apt-get install bash

Fedora systems patch:
Run these commands.  
sudo yum update -y bash

You have now updated your bash shell and will no longer be vulnerable.

Sunday, 26 June 2016

Python 3: Lesson 2 Basics

This lesson will include:
  • Input
  • Output
  • Storing values in variables
  • A combination of the above.
Variables are used to hold data within the program. In python you do not need to assign it to a certain data type as this is done automatically.
Example Use:
a = 5                 #This would be defined as an integer
b = "Hello, World"    #This would be defined as a string
c = 5.000             #This would be defined as a float

To allow the users to input data into the program we use the input() function. Most of the time this will be paired up with assigning it to a variable to store the data.
Example Use:

name = input("Please enter your name: ")

The "Please enter your name: " is the prompt that tells the user what the program is asking for.

To allow the program to output data from the program.
Example Use:

print("Hello, World!")
print(name) In this case the contents of the variable "name" will be printed to the screen

Combination of all three
We will now create a program that uses variables input and output.
First off we will get the user to input some data.

name = input("Please enter your name: ")
age = input("How old are you?: ")

We have now got two things from them, their name(stored in the variable "name") and their age(stored in the variable "age").

We can now print this variables out with a print statement.
print("Hello",name,"you are",age, "years old")

You now have a program that will ask the user their name and age and print out the output of both of these in a sentence.

Saturday, 25 June 2016

Python3: Lesson 1 Installing Python

Python is a high level interpreted programming language. It's user friendly code allows anyone to start learning it at home.

Installing Python
Most Linux distributions come with python installed out of the box. Open up a terminal and type python3 to check. If you don't get any errors then you are ready to go.

Installing on Debian systems:
sudo apt-get install python3

Installing from source:
wget --no-check-certificate
tar xvf Python-3.4.3.tgz
cd Python-3.4.3
sudo make install

Now when you type the command python3 It should open up a python terminal.