Cal Poly | NetApp
Programming
Blocking Sites in Ubuntu
Aug 25th
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
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.
Avoiding ‘mkdir -p’ in Perl by using File::Path::make_path()
Jul 7th
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:
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.
Setting Bash Environment Variables
Jul 3rd
If you are using the shell 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’
![[Google]]( http://ericosgood.com/wp-content/plugins/easy-adsenser/google-light.gif)
Recent Comments