Blocking Sites in Ubuntu

If you share a computer or have small children you don’t want visiting certain sites, here is a way to easily block them if you are an Ubuntu user:

1) you will need to have sudo permission

2) run the following command to edit /etc/hosts – sudo gedit /etc/hosts

3) Now, under the lines:

127.0.0.1       osgood-desk     localhost.localdomain   localhost
127.0.1.1       ubuntu.ubuntu-domain    ubuntu

127.0.0.1       osgood-desk     localhost.localdomain

The next step is to simply add:

127.0.0.1 examplesite1.com

127.0.0.1 examplesite.com

4) Now, anytime someone tries to visit examplesite1 or examplesite2, their browser will be unable to access the site.

1 Comment

Filed under Linux

Protected: Quotes from NetApp – Summer 2010

This post is password protected. To view it please enter your password below:


Enter your password to view comments.

Filed under NetApp Summer 2010

Avoiding ‘mkdir -p’ in Perl by using File::Path::make_path()

Using “ (back ticks) to implement the unix ‘mkdir -p’  is a “ghetto hack” and can now be circumvented by using File::Path::make_path. Here is some example code that implements that functionality:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
###############################################################################
# Subroutine: mkdir
#
# Function that emulates unix's "mkdir -p"
#
# Arguments: Scalar String - the path in question
#
# Returns: Scalar - either an integer representing the number of new directories created or an error message
sub mkdir($) {
my $path = shift;
my $err_msg;
# attempt a 'mkdir -p' on the provided path and catch any errors returned
my $mkdir_out = make_path( $path, { error => \my $err } );
# catch and return the error if there was one
if (@$err) {
for my $diag (@$err) {
my ( $file, $message ) = %$diag;
$err_msg .= $message;
}
print "$err_msg";
} else {
print "$mkdir_out";
}
} ## end sub mkdir($)

this subroutine will will try to create the path specified and will either print an int representing the number of new directories created or an error message.

7 Comments

Filed under Programming

Setting Bash Environment Variables

If you are using bash in Ubuntu and want to change your $PATH or $HOME variable permanently and not on a per session basis, the easiest way, IMO, is to simply edit ~/.bashrc. Adding the following line to .bashrc will add some directories to your $PATH variable:

‘export PATH=$PATH:/path/to/some/dirs:/path/to/some/more/dirs’

if you are using the shell, edit $HOME/.cshrc and add

setenv PATH “/usr/software/bin:/usr/software/sbin:”

2 Comments

Filed under Linux, Programming

Google Ships Android 2.01 without Exhange ActiveSync Security

For those of us using an Android based phone (Motorola Droid), Verizon and Google have shipped the newest release without support for ActiveSynce security, a feature both Windows Mobile and the iPhone have supported since their inception. This is a case of blatant false advertisement on the part of both Verizon and Google considering that they claim the Android OS supports Exchange right out-of-the-box. Check out the following link from Google’s own website: Google Failing

Leave a Comment

Filed under Technology