Labels

Wednesday, March 12, 2014

Gain Free Logins to Registered Only Areas - BugMeNot (More)

Hi!

In this post I will tell you how to gain accesso to restricted area sites which require registration.

This is not a hacker-based or warez-based post, I will show you how LEGALLY obtain these credentials to gain access only to FREE contents protected with user registration.

Often happens that you came across a site which contains some data or file that you need.

You will think 'Great! I found it! '

Well, once clicked the "Download Button" a nice, beautifull, super mega iper-annoying registration mask appears.

In my opinion that procedure it's annoying for two reasons:

  1. Time wasting process (usually we are in a hurry so we don't want to waste time for these processes)
  2. Usually registration are requested also to collect emails that will be used for ads or mailing list purposes.
To obtain an access you can visit

http://www.bugmenot.com

This page will be like this:
In domain url you have to insert a domain for which you want access credentials.

Then you'll be given credentials to obtain access.
You can also rate the success or failure of the credentials.

You can also contribute to increase the credentials database and share usefull logins and credentials.

Bye!

Wednesday, March 5, 2014

Install Corsair Force GT SATA3 on MacBook Pro late 2009


In this short article I will explain how to install a Corsair Force GT SATA3 SSD on a MBP 240GByte from the second half of 2009. The installation of this device makes it possible to greatly increase the performance in accessing the mass memory . The device's datasheet is available on the official
Corsair website.Attention, before continuing you make a backup of your data and your operating system with Time Machine on any external USB disk !The SSD drive is presented as below:



It has a normal connection port which supports the SATA and SATA3 protocols capable of a throughput up to 6Gbps . Obviously the MBP Late 2009 does not support this speed , but fortunately the device is backward compatible with SATA 2 and SATA versions .

To install Corsair Force GT SATA3 on our MBP is first necessary to remove the bottom of the computer . There are a total of 8 small screws that hold the cover closed . Once removed, you can remove the cover screws . At this point you are faced with this situation :


 
The device circled in red is the hard drive on your computer. To remove , unscrew the two screws that secure cross rod black . The bar essentially serves to keep in place the hard drive.






 The hard disk can now be removed from its slot. To do this properly you should remove it from the part where you removed the black rod held by two screws, and remove it from its location. Around the disc , there are 4 screws protruding.  


These screws Pentalobe type , can also be removed with some Torx screwdrivers , or you can use small pliers to loosen them . It's necessary to remove these screws and use them on the new SSD . Once attached the new Corsair Force GT SATA3 SSD drive you can place it in the joint and it is still possible to set the bar with the two black screws. 

We can now close the computer putting together all the screws .At this point we turn on the computer and we can start to use it. It may be a good idea to restore a backup version stored in advance with Time Machine to an external disk .  

This will allow us to retrieve data and operating system in its entirety , with the advantage of having a photocopy of your PC to a new disk at high speed, Corsair Force GT SATA3 .

Saturday, March 1, 2014

Smart way to write "trace" command in Matlab - Boost your code, save time

Sometimes is necessary to write complex operations in Matlab involving matrices. These operations can be of different type and they operate in different ways.

Today I'll show you how write in a smart way the "trace" command of a matrix or a product/sum/difference of the using matrices notation to speed up your code.

What is the trace command? Well, read here

As you read in the Wiki above, a trace will sum all the diagonal elements of a given matrix.

So for a give matrix A holds that:

This operation in Matlab is done through the command "trace( )" where between parenthesis you must pass the matrix for which you want to obtain the trace.

In a complex program it could happend to call a high number of times this command and it's time expensive specially if applied to matrices of big dimensions.

Tip 1: Get the trace of a given matrix A

To speed up the computation of a matrix you can apply this command:

sum(diag(A))

which means: sum the elements of the vector which results from the extraction of the diagonal elements of A.

If you have different matrices you can put them togheter inside a bigger one (see blkdiag) and apply this command.

Tip 2: Get the trace of a product of matrices AB

This is a very usefull tip;

you can rewrite trace(A*B) as

Suppose that A and B are two sqare matrices of dimension m x m.

reshape(A',1,m*m) * reshape(B,m*m,1)

Applying these tricks to complex Matlab programs will save your time!

Enjoy



Thursday, February 27, 2014

Secure VNC connections with Free VNC edition

VNC is a usefull tool which permits to administrate remotely a computer. The free version of this tool has great features, but not the one about SSL communication during a VNC session.
This may result in different security issues, such as traffic sniffing that can cause sensitive data theft. To avoid these possible annoying issues we can route the VNC session inside a SSL connection and secure the communication.

In this tutorial I will show how make a secure tunnel connection and then route the free VNC edition through this tunnel to secure the communication of the VNC session.

What we need:

  • 2 hosts, generally one is depicted as a server and the other one as a client.
    • VNC server installed on the server host
    • VNC viewer installed on the client host
    • freesshd installed on the server host (if windows based) or openssh-server (on linux machines)
    • putty installed on client machine (if windows based) or openssh-client (on linux machines)
 As seen in the post "SSH Tunneling" on this blog is possible to create a secure tunnel between two hosts. Here below we will see the commands that must be used to create a tunnel:

Under Linux machines on the client side:


ssh user@serverip -L <LOCAL_PORT>:127.0.0.1:<VNC_PORT_ON_SERVER>


Where:
  • <LOCAL_PORT> is the port on the client host where VNC connection will be redirected.
  • <VNC_PORT_ON_SERVER> is the port on the server where VNC service is running.
  • The middle address "127.0.0.1" means that the <VNC_PORT_ON_SERVER> on the host 127.0.0.1 (so the server to which we are connecting) will be redirected to <LOCAL_PORT> on the client.
Under Windows machines on the client side:

Start putty and under the Session section place user@serverip in the circled field.

Under SSH->Tunnels:
In Source Port place the equivalent of <LOCAL_PORT>
In Destination place the equivalent of "127.0.0.1:<VNC_PORT_ON_SERVER>"

Once set up, click Open.

Now, both on Windows or Linux machines, you can open the secure VNC session connecting to:

127.0.0.1:<LOCAL_PORT>

In this case the packets will be routed through the ssh connection until they get to the server.

VNC Free + secure connections.


Enjoy

Friday, June 7, 2013

Latex on PowerPoint

This is just too good to be true... I've always loved how easy it is to make presentations on MS PowerPoint, but we have to admit that when it comes to writing equations, Latex is the way to go.
The bad thing is that Beamer (the latex package for presentations) doesn't have all the nice (and above all "Click and Go") options that PowerPoint has. So, for those like me that want something pretty looking and fast to do, but prefer equations on latex, the solution is Iguana Tex, an add in for PPT that allows you to write equations in latex directly on your ppt document.
Just be sure that you have:
A latex installation (such as MikTex)
The dvipng package
the zhmetrics package

Here is the Iguana Tex site, which includes a very helpful FAQ:

http://www.technion.ac.il/~zvikabh/software/iguanatex/


Another option (which might work better in some cases) is this:

http://thd.pnpi.spb.ru/~gromov/mytexpoint.html

in this case, you should install first pstoedit: http://www.pstoedit.net/
and ghostscript:   http://www.ghostscript.com/
and indicate their paths the first time you run the program.

Friday, July 27, 2012

Automated Rotation Backup Script

Hi guys!

In this post we'll se something useful about backup your personal data!

Backup data is very important, especially for people that use computer for work. The loss of important data can be a nefarious event.

What we need to run this script is:

- Personal Computer with a distribution of Linux Installed
- About 5 minutes of patience :-)

Follow the step-by-step guide here below:

1 - Open a text editor like Vi, gedit, emacs or others and create an empty file.

2 - Copy and paste this code:


#!/bin/bash

# Author: Marcello Torchio

# Set the directory name that you wish to backup
DIRTOBACKUP=$1

# Set up the backup destination directory
BACKUPDIRDEST=$2

# Set up the number of days for backup rotation
NUMDAYS=7;

# Start logging
echo "["$(date)"] - Started Backup"
# Check if the destination dir exists. If not create it
if [ ! -d "$BACKUPDIRDEST/"$(date +"%m-%d-%Y")"/" ]; then
    # Creates directory for today's backup
    mkdir $BACKUPDIR/"$(date +"%m-%d-%Y")"
fi

# Echo the log line.
echo "["$(date)"] - Backup directory $DIRTOBACKUP in $BACKUPDIRDEST/"$(date +"%m-%d-%Y")"/"
# Execute the backup command. This backup consist in a recursive copy of the source dir into destination dir
cp -R $DIRTOBACKUP $BACKUPDIRDEST/"$(date +"%m-%d-%Y")"/

TOTMB=$(du $BACKUPDIRDEST/"$(date +"%m-%d-%Y")"/ -hs)
echo "["$(date)"] - Finished Backup - $TOTMB Copied"

# Search for folders older than NUMDAYS days and remove them. This makes possible rotation of backups
for i in `find $BACKUPDIRDEST/ -maxdepth 1 -type d -mtime +$NUMDAYS -print`;
do
        echo -e "["$(date)"] - Found outdated backup folder! Deleting directory $i";
        \rm -rf $i;
done

This is the script that will makes backup of a specified directory and implements rotation. Rotation in backups means that some old backup files will be deleted automatically and newer will be shifted to replace them. You can set the number of days after which the old backup folders will be deleted. This can be done through changing the NUMDAYS variable. This variable is set up to 7 days by default. Once you have pasted script into a file, save it as "backup_script.sh"

3 - The script must obtain the "x" flag because it's necessary to make possible to eXecute it. So open linux terminal and go to the directory where the script is and type


chmod +x backup_script.sh

4 -  To run this script you must use terminal, cd to the directory where the script is and type


./backup_script.sh what where

Where:
  • the parameter <what> must defines the ABSOLUTE path of the directory that must be "backupped".
  • the parameter <where> must defines the ABSOLUTE path of the directory where the backup will be stored
This script generates also a log text. In fact if you run it from terminal you'll see a list of log lines talking about the backup operations. If you want to store them into a separate file you can execute the script in this way:

./backup_script.sh what where > backup_log.log 

so in this way the log lines will be stored in backup_log.log file.

5 - We need to execute the last step, the automation of this process. To automate the backup process and schedule it we can use cron. Cron is a daemon that can execute scheduled commands for every user of a machine. You can schedule a command to be executed specifying the minutes of a day when execute it, the hours, the days etc like shown here below.

.---------------- [m]inute (0 - 59) 
|  .------------- [h]our (0 - 23)
|  |  .---------- [d]ay [o]f [m]onth (1 - 31)
|  |  |  .------- [mon]th (1 - 12) OR jan,feb,mar,apr... 
|  |  |  |  .---- [d]ay [o]f [w]eek (0 - 6) (sunday=0 o 7)  OR sun,mon,tue,wed,thu,fri,sat 
|  |  |  |  |

*  *  *  *  *  comand to be executed


Now we have got to add a scheduled execution of our backup script. Here is an example that you can personalize at your own. For first thing open linux terminal and type

crontab -e


In this way you will edit your cron scheduled commands. (-e option means edit). Now we insert the scheduled execution of our script. To do this, before you can edit the content you must press the key "I" that switches the editor mode into "INSERT" mode. Now it's possible to enter data. Type something like

45 15 * * * /path/to/backup_script.sh > /path/to/backup_log.log


You have to define the absolute path to your script, so replace /path/to/ with the exactly absolute path where the script is placed. Once finished to edit the content press the button "ESC" that switches from "INSERT" mode to "VIEW" mode and type ":wq" and hit return. "wq" means "write changes and quit". Now we have added a scheduled execution of the script to the cron daemon. We can verify this typing


crontab -l


that means to "list" all the cron entries for this user. In the example above we have scheduled the execution of the script every month, every day of the week and the month, at 15.45 (in 24h notation, else 3.45PM in 12h notation). In this way your backups will be automated and the old backups will be automatically deleted and replaced with the shifting logic introduced below.

Bye

Saturday, July 21, 2012

My First Post on Happy Engineer - SSH Tunneling

Hi everyone,

my name is Marcello and i'm a junior engineer ( i'm about to graduate ). I have a lot of interests, the two principals are Music and Computer Science. I'm also a drum player (i'm very louder :) ). I don't play drums only for myself, in fact i have a band named Apocalypse Please (quote Muse) and we play Metal music (our songs, few covers).

this is the first time i write on this blog and i'm very proud to do this and I thank Andres for the opportunity he gave me.



The first thing i want to explain in this post is the powerful tool named "SSH". Today i'm a totally Linux lover. When i was young, at the beginning of my computer science experience, i was not very practical of linux and my little knowledge about roots of operating systems doesn't helped me to understand better the potentiality of the little Penguin.

A very powerfull tool is SSH. SSH is the acronym of secure shell and is a kind of prehistoric version of Remote Desktop Connection or VNC. The main difference between VNC, RDC and SSH is that SSH make possible to manage a remote host using without using GUIs, but only through a prompt.

You can think "Bleah, only a poor command prompt?  Where the way to unpack tarball is made of a long sequence of chars??? WTF????"

Answer: "Yes".

Trust me, if you begin to use linux's terminal it will be the END. You'll not use linux without using terminal! It's a drug!

But, wait a second, try to think about the idea of sending only few bytes to manage remote hosts instead of large quantities of bytes for send screenshots of VNC and RDC. It sounds good!!

Leaving behind these considerations, let's talk technically.

If you want to connect to a remote host using ssh you have to be sure of two things:

1 - The remote host must have installed a SSH daemon (OpenSSH for example) and must be correctly configured.

In Ubuntu distributions is very simple to install OpenSSH, just open terminal and type:

    sudo apt-get install openssh-server

Once installed, the daemon will startup automatically when the host starts up, and all the user of the host will be enabled to use ssh service, so if you want to access to your machine you can use the credentials you normally use to access the host.

2- You must know a pair o username-password enabled on the remote host.

Try to connect to a remote host using ssh. Open the terminal and type:

    ssh username@hostip



Where:

    Username is the username on the remote host
    hostip defines the remote host ip you want to connect using SSH

 If you want to test if OpenSSH is working on your local host you can run:

    ssh yourusername@localhost



After the execution of this command you'll be asked to accept a key and you'll need to answer "yes".

    What's the meaning of this question?



SSH bases its operation on the use on a public key cryptography system and the first time you make a connection to a remote host you must accept its public key to start the conversation.

    Wow... Now i'm connected to a remote host.. And now?



The main advantage of using SSH for administrate remote hosts is the limitate usage of bandwidth. It seems a nonsense, but there are a lot of situations where the optimization of bandwidth usage can make the difference.



    Yeah. .. Boring Things...



Wait!

There's a little funcionality of SSH that is very powerfull. The Tunneling. Tunneling defines the possibility to make a tunnel between two hosts and make possible to exchange data between them.



Imagine to have three hosts:

    host A, connected to the internet, placed in Australia
    host B and C in the same subnet but only B is directly connected to the Internet. These two hosts are in Norway.

Imagine also that host A must access to C for some reasons. There are a lot of ways to do this for example VPNs (maybe we talk about this another time).. Another way can be tunneling.

Idea!

Using host B like a gateway for exchange data with C. Great! How?

SSH

There's a little tiny argument that you can pass to SSH command before execute it. The -L argument. Let's see a usage for this argument.

    ssh johndoe@hostB -L 5000:hostC:21



In this example i'm connecting to the host B placed in Norway, using the username johndoe. Passing -L argument i'm saying to ssh to bind port 21 of hostC (hostC must be the subnet's ip of host C) to the port 5000 of my host. So if i connect using a FTP client to port 5000 of my localhost, the communication will be routed through the tunnel to host C using host B like a gateway.

So if you have the possibility to access a host of a subnet using SSH, you'll be able to access on every host of that subnet.

I wish that you will appreciate this post. I'm also happy if you want to correct me in contents or in grammar (i'm not so trained about writing english :) )

Yhank you, see you soon