Wednesday, February 22, 2012

grub ubuntu

Configure netbeans fonts in ubuntu

sudo gedit /usr/local/netbeans-7.1/etc/netbeans.conf


add this at the end of the line
--laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd

or just this, if you don't won't the new java look.
-J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd

Tuesday, February 21, 2012

How to setup a Google Apps account in Pidgin?

You have to change the advanced options of the account.

Set "Server" to

Tuesday, February 14, 2012


Username and Email
git config --global "Pedro Abrantes"
git config --global
git config --global diff.tool meld
git config --global merge.tool meld
git config --global push.default matching

Use colors in git
git config color.ui true

Pretty Log
git config format.pretty oneline

Get latest from server
git fetch origin
git merge origin/"branch"

Delete branch
git branch -d branch
git push origin --delete branch

View differences between branches
git difftool master..devel

View differences between local file and other branch
git difftool  other_branch -- path_to_file
git difftool  other_branch path_to_file

View differences between branched for one specific file
git difftool  one_branch other_branch -- path_to_file
git difftool  one_branc..other_branch path_to_file

Get an archive from differences between branches
git archive -o version3.1.18a $(git diff --name-only version3.1.18_merged )

How do I create a new git branch from an old commit and checkout it?
git checkout -b <name> <oct>

Checkout file from previous commit

First get the file back from one commit before:

git checkout HEAD~1 path/to/file.ext
Then commit it:

git commit -a -m 'Retrieved file from older revision'
If only the changes to that file where present in the last commit, you can even use git-revert:

git revert HEAD
I think it would be better to make this a separate commit, because it tells you exactly what you've reverted, and why. However, you can squash this into the previous commit by using the --amend switch to git-commit.

Checkout a remote branch without locally created
git checkout -t origin/branch
git fetch origin
git checkout -b test origin/test

Check files on disk
git fsck-objects --full

To see the changes between the working directory and the index. This shows what has been changed, but is not staged for a commit.

git diff

To see the changes between the index and the HEAD(which is the last commit on this branch). This shows what has been added to the index and staged for a commit.

git diff --cached

To see all the changes between the working directory and HEAD (which includes changes in the index). This shows all the changes since the last commit, whether or not they have been staged for commit or not.

git diff HEAD

To view only the difference in patch mode
git format-patch branch1..branch2

to make a single patch use:

git format-patch branch1..branch2 --stdout > my_new_patch.diff
and apply
git am < my_new_patch.diff

To squash all commits since you branched away from master, do
git rebase -i master

Saturday, February 04, 2012

Check open ports on Ubuntu Linux

One may want to check open ports on Ubuntu to ensure that there are no services listening that shouldn't be. If we remember, a port is what an application will use to communicate with another application, provide a service, etc. To get an idea of what services are running on a system, we would need to check the open ports on the system.
It is easy for us to install a program which provides a service and then forget about it, so we may have our machine listening on a number of ports waiting for incoming connections. Attackers love when ports are open, as the applications listening on these ports are the easiest targets. In order to ensure that our Ubuntu Linux system (or any other system for that matter) is as secure as possible, we need to be aware of what ports are open and providing what services.
In the tutorial below, we will look at how to check open ports on Ubuntu or other versions of Linux.

Checking open ports on Ubuntu

To check which ports are open on our Ubuntu box, we can issue the command shown below. Note that this should also work for other flavours of Linux as long as they have netstat installed.
Run the following in a terminal:
netstat -anltp | grep "LISTEN"
The typical web server which runs FTP, SSH, and MySQL will have output like:
tcp     0   0*   LISTEN   21432/mysqld
tcp     0   0*   LISTEN   4090/apache2
tcp     0   0*   LISTEN   7213/sshd
tcp6    0   0 :::21             :::*        LISTEN   19023/proftpd
tcp6    0   0 :::22             :::*        LISTEN   7234/sshd
What the above command does is run the netstat utility with the appropriate flags, then pipes the output to grep which then extracts the lines which contain the word "LISTEN". What we have as the result of that, is a list of the ports that we have open and the names of the processes which are listening on those ports.

Which ports are open to the world

Note that a service may have a port open, but that port may be only listening on the current machine. That is, a port is open, but you will not be able to access it from over the network. This is useful for security as something like a web server should have port 80 open to the world, but the world need not know about (or be able to connect to) port 3306, the port which the MySQL server that powers the website is listening on.
Ideally, if you are running a web server, the only ports that you would want visible on the outside are HTTP port 80 and maybe SSH port 22 since you still need to be able to connect to the web server to run commands.
The ports which have services available to the localhost only, will have the IP address in its local address field. In the example above, that would be:
tcp     0   0*   LISTEN   21432/mysqld
As we can see, MySQL is listening on port 3306 on an IP address of This means that only programs on the same machine will be able to connect to the MySQL server.
That is it for this tutorial on checking open ports on Ubuntu Linux. We hope you enjoyed it. Check out the links below for other articles which you may like.

Friday, February 03, 2012


É maior que Deus, Pior que o diabo, os pobres tem, os ricos precisam, quando você come morre.?

How to get the IP address of the docker host from inside a docker container

/sbin/ip route|awk '/default/ { print $3 }'