Install LaTeX in Ubuntu

LaTeX is a markup language which produces documents, separating content and style. While using LaTeX, you have to focus on content without worrying about the style. For using it, just learn few commands and you are good to go.

There are number of LaTeX distributions and one of them is TeX Live.

To install Tex Live, type this command on your terminal:

sudo apt-get install texlive-full

After this is complete, we need to install LaTeX editor. There are many available, but I am using Texmaker. To install it, type:

sudo apt-get install texmaker

After you are done with installation part, open it from terminal by typing following:

texmaker

Okay! Now here is small tutorial on how to create a document in LaTeX. Click on File -> New and type following in space provided:

  1. \documentclass{article}
  2. \begin{document}
  3. Hello world!
  4. \end{document}

Save it as a ‘tex’ file by clicking File -> Save. Compile the document clicking the arrow Quick Build.

Now enjoy creating your documents without being worried about its style 🙂

 

Recovery of Corrupt or absent IOS on cisco switch

First, enter rommon mode by unplugging and plugging the power cable back and press the mode button for few seconds. Also, keep in mind to set the BUAD rate as high as possible to speed up the downloading process.

s2

Once you are in rommon mode, type the following commands,

Switch: flash_init

Switch: reset

s2

In enable mode, type command to delete old or corrupt flash (this command is going to take a few moments).

Switch# erase flash:

Switch# reload

s3

You can verify it with  # dir flash:

After you finish booting, you will enter rommon mode as there is no ios. Type,

switch: copy xmodem: flash:c2960-lanbase-mz.122-35.SE5.bin

go to Transfer Tab “Send File…” browse the file on desktop and the protocol is “Xmodem”

s6

This is going to take while. Once you finish this, type:

unset BAUD

s7

Establish a new connection with default setting and reset to restart the switch or simply type switch: boot to load ios. With this, we are done and you can use your switch. 🙂

 

 

Add client to Active Directory Domain on Window server 2012

Your domain controller is of no use if you haven’t added machines to it. So here I am going to show simple steps to add client (window server 2008 r2) to window server 2012 domain.

From the AD users and computers of server 2012, right click computers, then go to New|Computer. In the prompt asking for name, give name of your client machine.

jcThen switch to client machine, and make sure in network settings, DNS is pointing to the correct DNS server. In my case, DNS address is same as IP address of server 2012. To make sure, ping your domain from client machine.

Now, in the system settings of window server 2008, click ‘Provide computer name and domain’ and then ‘change’ (Pic. 2).

In a prompt, select domain, and correctly put the name of your domain in space provided and press OK (Pic. 3).

Congratulations! You just connected your client to your domain.

jc2jc3jc1

All about active directory users and computers (Window Server):

As name implies, active directory users and computers is used to manage users, groups, computers, domains, organizational units in Active Directory.  Using this Microsoft Management Console (MMC), you can create new users, reset their passwords, add them to certain groups, grant certain rights, move them, enable or disable them and so on. You can access AD users and computers mmc from tools or by typing “dsa.msc” in run.

ad1

If you expand domain name (college.local) in left pane, you can see different containers like builtin, computers, Domain Controllers etc.Builtin contains the automatically created security groups like Administrators, Backup Operators and

Builtin contains the automatically created security groups like Administrators, Backup Operators and many more that Microsoft creates for our easiness. Brief description of each group is given on the right hand.Computers container is the default containers of all workstations or computer objects in active directory.

Computers container is the default containers of all workstations or computer objects in active directory.Domain Controller contains all domain controllers in active directory domain.

Domain Controller contains all domain controllers in active directory domain.

Forest Security Principals contains the objects that belong to trusted external domains.

Users is default containers for all objects in active directory. Objects can be computers, groups, users, etc.

Create a new OU:

Organisational unit is a container in active directory to which group policies can be applied. To create OU, right click on the domain, then new and select organisational unit. Give a unique name in screen and enter OK.

ad2

ad2

Create a user and add a user to group:

To create a user, right click on OU and then new|user. Follow the prompts to add new user. If you want to add user to a group, then right click the user and select add to a group. In a prompt ‘select groups’, type in the first few words, then click check names. Then select the group you want to the user to be member of. If you are not sure about group name, then click Advanced. Click Find Now to see all the groups.

Note: Ordinary user cannot login into domain controller. The user should be member of ‘domain admins’.

ad3

 

ad3

There are many other things you can do in AD users and computers like Move a user, create a group, delete a group, reset password, set logon times and so on.

Way to Change text colour of icon on Desktop|Ubuntu 12.04 desk

If you are jaded with text color of your icons on desktop, then you just need to make few changes. Here are steps:

Go to path:

 /usr/share/themes/Ambiance/gtk-3.0/apps/

This path is for Ambiance  (theme in my case), if you are using Radiance or something like that, don’t worry. Make a little change in your path. Replace Ambiance with a theme you are using.

Now, in apps you would find a file “nautilus.css”.

Look for a line:

color: @bg_color;

Replace the @bg_color with hex code of color you want. It would be better if you uncomment the above line and copy it to replace hex code of color.

/*color: @bg_color;*/

color: #FF0000;

Then you will get your own color .Enjoy !!

 

Drivers are up to date but the keyboard is still not working

So I encountered a weird error. I was installing VM but when I restarted my laptop, my keyboard stopped working K. So I ran Diagnostics to check if it is the hardware issue, which luckily was not. So I used the on-screen keyboard to log onto my system to check if I need to upgrade my keyboard drivers. There was the tiny yellow mark on the near my keyboard driver. And I downloaded newer one from the internet and but that didn’t help either. It said you already have the up to date driver.

I found a very useful link about it – https://support.microsoft.com/en-us/kb/256233

What they said is simple enough but one has to very careful while editing Registry Editor because any mistake can make you reinstall your operating system.

Using your onscreen keyboard, type Regedit in the run. This will launch a window as shown in the picture below.

wordpress1

On the registry menu, click computer and then expand HKEY_LOCAL_MACHINE. Then go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e96b-e325-11ce-bfc1-08002be10318}

Double click the upper filters to remove Lkbdflt2 value.

Then go to other location : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4d36e96b-e325-11ce-bfc1-08002be10318} and in upper filters  remove Lmouflt2.

Then close and restart your computer. Everything should work fine now.

Install Havij in Ubuntu 12.04

Havij is SQL Injection tool and provides us with features for exploiting the SQL vulnerability.By using this software user can perform back-end database fingerprint, retrieve DBMS users and password hashes, dump tables and columns, fetching data from the database, running SQL statements and even accessing the underlying file system and executing commands on the operating system.

Havij runs on windows based operating system. However you can use Wine to get havij in Linux.Here are few steps for installation of havij on your ununtu machine.

Open your terminal and give a command to install wine.

            sudo apt-get install wine

Then, download Havij using command:

          wget http://itsecteam.com/files/havij/Havij1.15Free.rar

You can also download it from http://www.itsecteam.com/products/havij-v116-advanced-sql-injection/index.html.Now, Untar the file using:

           unrar x Havij1.15Free.rar

Right click on the Havij .exe file and Choose Open with Wine Windows Program Loader and install it.

Havij

Screenshot from 2014-03-03 11:45:37

hh

Free version of Havij is limited in some features, one can purchase the commerical version at http://itsecteam.com

Install graphics.h in ubuntu

For using graphics.h library in Ubuntu, you need to follow few simple steps given below:

First of all, you need to install few packages. For that, run command this on your terminal “sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev”

Next you need to install libgraph package. Download libgraph-1.0.2.tar.gz from link:

download.savannah.gnu.org/releases/libgraph/libgraph-1.0.2.tar.gz

Extract this where you want. Now navigate to the folder, where you just extracted your libgraph-1.0.2.tar.gz using cd command. Run these commands on your terminal.

> cd libgraph-1.0.2
> ./configure
>sudo make
> sudo make install
> sudo cp /usr/local/lib/libgraph.* /usr/lib

And if you got error message “configure: error: *** SDL version 1.2.0 not found!”, try installing it using: sudo apt-get install libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev”

Another error which you can get is: “configure: cannot find guile-config; is Guile installed?” Solve this by using command“sudo apt-get install guile guile-dev.

If this didn’t helped much, then we have another way to get it work in right way. Use synaptic package manager to install related files.

synaptic

Now try compliling your C program.

#include<stdio.h>
#include<graphics.h>

int main()

{
int gd=DETECT,gm;
initgraph(&gd,&gm,NULL);
int i,x=10;
char str[3]=”0″;
setbkcolor(BLUE);

setcolor(12); //outline heart
circle(50,50,40);
circle(110,50,40);
line(22,80,80,140);
line(80,140,138,80);

floodfill(50,50,12); //fill heart
floodfill(110,50,12);
floodfill(80,50,12);
floodfill(80,100,12);

getch();
closegraph();
return 0;
}

terminal

 

Using PostgreSQL on ubuntu 12.04 LTS

PostgreSQL is a powerful object-relational database management system and has  bindings for many programming languages such as C, C++, Python, Java, PHP, Ruby…

Before you use it, you need to install it, ofcourse. To install it run following commands on your terminal:

apt-get install postgresql postgresql-contrib

You can also download it from ftp://ftp.postgresql.org/pub/source/v9.2.4/postgresql-9.2.4.tar.gz and
After you have obtained the file, unpack it:

gunzip postgresql-9.2.4.tar.gz
tar xf postgresql-9.2.4.tar

For the rest of the installation procedure, you need to change into the directory, which you created while unpacking it.

Creating a Database
To create a database, you need to login as a postgres user.

gurpinder@gurpinder:~$ sudo -u postgres -i

To create a new database, issue following command on your terminal:

postgres@gurpinder:~$ createdb testdb
postgres@gurpinder:~$ psql testdb

You should see output similar to the following:

psql (9.1.9) 
Type "help" for help. 
testdb=#

Creating Tables
To create a table in your test database called “student”, issue the following command:

testdb=#  CREATE TABLE student (student_id int, first_name varchar, last_name varchar);

Now if you want  insert a record into the table, use this:

testdb=# INSERT INTO student VALUES (2, 'Gurpinder', 'Chahal');

Now if you want to see the contents of table, issue this command:

testdb=# SELECT * FROM student;

This would produce output similar to the following:

testdb=# SELECT * FROM student; 
 student_id | first_name | last_name 
------------+------------+----------- 
          2 | Gurpinder  | Chahal 
(1 row)

To exit the psql shell, issue this command:
\q

If you do not want to use your data anymore, remove it by:

$ dropdb testdb

For more knowlegde of PostgreSQL look here: http://www.postgresql.org/docs/9.2/interactive/index.html

Know more about your installed Debian Packages

Here you will find all the commands which will tell you about your debian packages.

1. Now, if you are looking whether you’ve downloaded packages or not , then try these commands:

apt-cache search 'foo*'

That is how you tell apt to search the packages you’ve downloaded.

2. Another command which do the same in some different way is:

dpkg-query -l 'foo*'

3. Now, if you want to see the description of your package, use something like this:

apt-cache show postgresql

This displays what the package is designed to do, version info and so forth.

4. Now, if you are wondering which all packages are installed in your system, run this on your terminal:

dpkg -l

5. Now if you are thinking of viewing all installed packages along with there description, use this one:

dpkg -l \*
dpkg -l '*'

These list all packages. (Without the star glob, dpkg only lists installed packages.)

5. To Finds installed packages marked to be purged, put this on your terminal:

dpkg -l \* | grep ^pi

6. This lists packages marked for installation, that aren’t installed yet.

dpkg -l '*' | grep "^i[^i]"
dpkg -l \* | grep '^[^i]i'

7. And if you are looking for installed package with all its files(with full paths), then how about this:

dpkg -L php5
gurpinder@gurpinder:~$ dpkg -L php5
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/php5